summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Battersby <tonyb@cybernetics.com>2014-10-23 15:10:21 -0400
committerChristoph Hellwig <hch@lst.de>2014-10-28 09:53:43 +0100
commitae674792c32bc54832e52706ec669d59cbea7ab6 (patch)
tree893f6933071f4429c093f87a46baf9caa80651df
parentcac7f2429872d3733dc3f9915857b1691da2eb2f (diff)
downloadop-kernel-dev-ae674792c32bc54832e52706ec669d59cbea7ab6.zip
op-kernel-dev-ae674792c32bc54832e52706ec669d59cbea7ab6.tar.gz
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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 9cdf62f..c9f2e8c 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;
}
OpenPOWER on IntegriCloud