Skip to content

Commit ae67479

Browse files
abattersbyChristoph Hellwig
authored andcommitted
lib/scatterlist: fix memory leak with scsi-mq
Fix a memory leak with scsi-mq triggered by commands with large data transfer length. Fixes: c53c6d6 ("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>
1 parent cac7f24 commit ae67479

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎lib/scatterlist.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ void __sg_free_table(struct sg_table *table, unsigned int max_ents,
203203
}
204204

205205
table->orig_nents -= sg_size;
206-
if (!skip_first_chunk) {
207-
free_fn(sgl, alloc_size);
206+
if (skip_first_chunk)
208207
skip_first_chunk = false;
209-
}
208+
else
209+
free_fn(sgl, alloc_size);
210210
sgl = next;
211211
}
212212

0 commit comments

Comments
 (0)