Skip to contentSkip to conversation

lib/scatterlist: fix memory leak with scsi-mq

PATCH In review Tony Battersby 3 participants 3 messages Oct 23, 2014 – Oct 28, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 <[email protected]> # 3.17.x

---

For inclusion in 3.18 and 3.17.x.

lib/scatterlist.c +3 -3
@@ -203,10 +203,10 @@ void __sg_free_table(struct sg_table *ta
 		}
 
 		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;
 	}
 
#1 lore raw
Quoted 2 lines · Tony Battersby

Fix a memory leak with scsi-mq triggered by commands with large data transfer length.

Thanks, this was indeed caused by a last minute change due to someone complaining about my earlier version being a little too convoluted.

Thanks for tracking this down!

Reviewed-by on v1 1/1
#2 lore raw
In reply to Tony Battersby
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Tony" == Tony Battersby <[email protected]> writes:

Tony> Fix a memory leak with scsi-mq triggered by commands with large Tony> data transfer length.

Tony> Fixes: c53c6d6a68b1 ("scatterlist: allow chaining to preallocated Tony> chunks")

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering