diff options
author | Tony Battersby <tonyb@cybernetics.com> | 2014-10-23 21:10:21 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-10-28 09:53:43 +0100 |
commit | ae674792c32bc54832e52706ec669d59cbea7ab6 (patch) | |
tree | 893f6933071f4429c093f87a46baf9caa80651df | |
parent | Linux 3.18-rc2 (diff) | |
download | linux-ae674792c32bc54832e52706ec669d59cbea7ab6.tar.xz linux-ae674792c32bc54832e52706ec669d59cbea7ab6.zip |
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: Christoph Hellwig <hch@lst.de>
-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; } |