diff options
author | Tony Battersby <tonyb@cybernetics.com> | 2014-10-23 15:10:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-14 10:10:36 -0800 |
commit | a58c28f66aca396c19f297b6c29835971a1e2886 (patch) | |
tree | 02e6e319b400736cd2a8b49fc054a2e826337c2f /lib | |
parent | 37ca06e5d8cfe85d810c93a58fd429265adf8935 (diff) | |
download | lwn-a58c28f66aca396c19f297b6c29835971a1e2886.tar.gz lwn-a58c28f66aca396c19f297b6c29835971a1e2886.zip |
lib/scatterlist: fix memory leak with scsi-mq
commit c21e59d8dc04b2107bdb4ff0f412a9b7ae3349f3 upstream.
Fix a memory leak with scsi-mq triggered by commands with large data
transfer length.
Fixes: c53c6d6a68b1 ("scatterlist: allow chaining to preallocated chunks")
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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, } 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; } |