diff options
author | Tony Battersby <tonyb@cybernetics.com> | 2014-10-23 15:10:21 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-10-28 12:27:10 -0400 |
commit | c21e59d8dc04b2107bdb4ff0f412a9b7ae3349f3 (patch) | |
tree | 01a12fe33e69209f0ba279d749558c47af17f952 /lib | |
parent | d32f6b57523b6e9b2e39e990e056f9882a6f099a (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.c | 6 |
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, | |||
203 | } | 203 | } |
204 | 204 | ||
205 | table->orig_nents -= sg_size; | 205 | table->orig_nents -= sg_size; |
206 | if (!skip_first_chunk) { | 206 | if (skip_first_chunk) |
207 | free_fn(sgl, alloc_size); | ||
208 | skip_first_chunk = false; | 207 | skip_first_chunk = false; |
209 | } | 208 | else |
209 | free_fn(sgl, alloc_size); | ||
210 | sgl = next; | 210 | sgl = next; |
211 | } | 211 | } |
212 | 212 | ||