diff options
author | Tony Battersby <tonyb@cybernetics.com> | 2015-07-16 11:40:41 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-07-30 10:40:33 -0700 |
commit | 0c958ecc69c277b25f38f72bc6d18ab145e8167c (patch) | |
tree | bc2bad55954762cbafac0651b2250675762e890b /drivers/usb/misc/appledisplay.c | |
parent | 3f1c0581310d5d94bd72740231507e763a6252a4 (diff) | |
download | op-kernel-dev-0c958ecc69c277b25f38f72bc6d18ab145e8167c.zip op-kernel-dev-0c958ecc69c277b25f38f72bc6d18ab145e8167c.tar.gz |
scsi: fix memory leak with scsi-mq
Fix a memory leak with scsi-mq triggered by commands with large data
transfer length.
__sg_alloc_table() sets both table->nents and table->orig_nents to the
same value. When the scatterlist is DMA-mapped, table->nents is
overwritten with the (possibly smaller) size of the DMA-mapped
scatterlist, while table->orig_nents retains the original size of the
allocated scatterlist. scsi_free_sgtable() should therefore check
orig_nents instead of nents, and all code that initializes sdb->table
without calling __sg_alloc_table() should set both nents and orig_nents.
Fixes: d285203cf647 ("scsi: add support for a blk-mq based I/O path.")
Cc: <stable@vger.kernel.org> # 3.17+
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'drivers/usb/misc/appledisplay.c')
0 files changed, 0 insertions, 0 deletions