aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl/ctl_tpc.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2014-12-03 08:25:41 +0000
committerAlexander Motin <mav@FreeBSD.org>2014-12-03 08:25:41 +0000
commit2a72b5936d83b767e6438b4a8e9beb724447fd81 (patch)
tree6e3e7907adb6ded3f5276573f553ab35a85a9b6e /sys/cam/ctl/ctl_tpc.c
parent18961126cbc232e5108e64ad28dadd2ccab46b34 (diff)
downloadsrc-2a72b5936d83b767e6438b4a8e9beb724447fd81.tar.gz
src-2a72b5936d83b767e6438b4a8e9beb724447fd81.zip
Plug memory leaks on UNMAP and XCOPY with invalid parameters.
MFC after: 1 week
Notes
Notes: svn path=/head/; revision=275446
Diffstat (limited to 'sys/cam/ctl/ctl_tpc.c')
-rw-r--r--sys/cam/ctl/ctl_tpc.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c
index c715f877a0af..90a31ae59e03 100644
--- a/sys/cam/ctl/ctl_tpc.c
+++ b/sys/cam/ctl/ctl_tpc.c
@@ -1644,6 +1644,10 @@ ctl_extended_copy_lid1(struct ctl_scsiio *ctsio)
return (CTL_RETVAL_COMPLETE);
done:
+ if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) {
+ free(ctsio->kern_data_ptr, M_CTL);
+ ctsio->io_hdr.flags &= ~CTL_FLAG_ALLOCATED;
+ }
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -1767,6 +1771,10 @@ ctl_extended_copy_lid4(struct ctl_scsiio *ctsio)
return (CTL_RETVAL_COMPLETE);
done:
+ if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) {
+ free(ctsio->kern_data_ptr, M_CTL);
+ ctsio->io_hdr.flags &= ~CTL_FLAG_ALLOCATED;
+ }
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -1944,8 +1952,10 @@ ctl_populate_token(struct ctl_scsiio *ctsio)
return (CTL_RETVAL_COMPLETE);
done:
- if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED)
+ if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) {
free(ctsio->kern_data_ptr, M_CTL);
+ ctsio->io_hdr.flags &= ~CTL_FLAG_ALLOCATED;
+ }
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -2069,8 +2079,10 @@ ctl_write_using_token(struct ctl_scsiio *ctsio)
return (CTL_RETVAL_COMPLETE);
done:
- if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED)
+ if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) {
free(ctsio->kern_data_ptr, M_CTL);
+ ctsio->io_hdr.flags &= ~CTL_FLAG_ALLOCATED;
+ }
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}