summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTony Battersby <tonyb@cybernetics.com>2014-10-23 15:10:21 -0400
committerJens Axboe <axboe@fb.com>2014-10-28 10:27:10 -0600
commitc21e59d8dc04b2107bdb4ff0f412a9b7ae3349f3 (patch)
tree01a12fe33e69209f0ba279d749558c47af17f952 /lib
parentd32f6b57523b6e9b2e39e990e056f9882a6f099a (diff)
lib/scatterlist: fix memory leak with scsi-mq
Fix a memory leak with scsi-mq triggered by commands with large data transfer length. Fixes: c53c6d6a68b1 ("scatterlist: allow chaining to preallocated chunks") Cc: <stable@vger.kernel.org> # 3.17.x Signed-off-by: Tony Battersby <tonyb@cybernetics.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/scatterlist.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 9cdf62f8accd..c9f2e8c6ccc9 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -203,10 +203,10 @@ void __sg_free_table(struct sg_table *table, unsigned int max_ents,
}
table->orig_nents -= sg_size;
- if (!skip_first_chunk) {
- free_fn(sgl, alloc_size);
+ if (skip_first_chunk)
skip_first_chunk = false;
- }
+ else
+ free_fn(sgl, alloc_size);
sgl = next;
}