Skip to content

Commit

Permalink
lib/scatterlist: fix memory leak with scsi-mq
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tony Battersby authored and Christoph Hellwig committed Oct 28, 2014
1 parent cac7f24 commit ae67479
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/scatterlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ae67479

Please sign in to comment.