camcontrol powermode: fix use-after-free

Free the ccb after processing the response therein.

Reported by:	Coverity
Fixes:		3bed0179ee
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
This commit is contained in:
Eric van Gyzen 2023-03-29 14:14:40 -05:00
parent 8f391d9098
commit 3bbd1a1a00

View File

@ -9312,12 +9312,11 @@ atapm(struct cam_device *device, int argc, char **argv,
/*timeout*/timeout ? timeout : 30 * 1000,
/*force48bit*/0);
if (retval == 0 && cmd == ATA_CHECK_POWER_MODE)
retval = atapm_proc_resp(device, ccb);
cam_freeccb(ccb);
if (retval || cmd != ATA_CHECK_POWER_MODE)
return (retval);
return (atapm_proc_resp(device, ccb));
return (retval);
}
static int