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: <[email protected]> # 3.17.x
Signed-off-by: Tony Battersby <[email protected]>
Reviewed-by: Martin K. Petersen <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
abattersby authored and axboe committed Oct 28, 2014
1 parent d32f6b5 commit c21e59d
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 c21e59d

Please sign in to comment.