summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2016-05-20 06:43:55 +0000
committertruckman <truckman@FreeBSD.org>2016-05-20 06:43:55 +0000
commit8fcbf690b634fd415438ce1e2f1496405ef39f4e (patch)
tree86ac9dcc2a90fce248c096cf34ec938a199896ed
parent5c329ee4289a660060ecf596cbc3801e8c819df8 (diff)
downloadFreeBSD-src-8fcbf690b634fd415438ce1e2f1496405ef39f4e.zip
FreeBSD-src-8fcbf690b634fd415438ce1e2f1496405ef39f4e.tar.gz
MFC r299592
Move a call to cam_freeccb() to avoid a use after free error and a later double free. Reported by: Coverity CID: 1018507
-rw-r--r--usr.sbin/mptutil/mpt_cam.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/mptutil/mpt_cam.c b/usr.sbin/mptutil/mpt_cam.c
index 6a8ff07..a00e228 100644
--- a/usr.sbin/mptutil/mpt_cam.c
+++ b/usr.sbin/mptutil/mpt_cam.c
@@ -260,7 +260,6 @@ fetch_scsi_capacity(struct cam_device *dev, struct mpt_standalone_disk *disk)
cam_freeccb(ccb);
return (EIO);
}
- cam_freeccb(ccb);
/*
* A last block of 2^32-1 means that the true capacity is over 2TB,
@@ -269,6 +268,7 @@ fetch_scsi_capacity(struct cam_device *dev, struct mpt_standalone_disk *disk)
*/
if (scsi_4btoul(rcap.addr) != 0xffffffff) {
disk->maxlba = scsi_4btoul(rcap.addr);
+ cam_freeccb(ccb);
return (0);
}
OpenPOWER on IntegriCloud