Skip to contentSkip to conversation

cxgb4: fix memory leak of qe on error exit path

PATCH New Colin King 1 participant 1 message Oct 16, 2016

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 cxgb4: fix memory leak of qe on error exit path

From: Colin Ian King <[email protected]>

A memory leak of qe occurs when t4_sched_queue_unbind fails, so fix this by free'ing qe on the error exit path.

---
 drivers/net/ethernet/chelsio/cxgb4/sched.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/sched.c +3 -1
index 539de76..cbd68a8 100644
@@ -210,8 +210,10 @@ static int t4_sched_queue_bind(struct port_info *pi, struct ch_sched_queue *p)
 
 	/* Unbind queue from any existing class */
 	err = t4_sched_queue_unbind(pi, p);
-	if (err)
+	if (err) {
+		t4_free_mem(qe);
 		goto out;
+	}
 
 	/* Bind queue to specified class */
 	memset(qe, 0, sizeof(*qe));
Signature · 1 line
2.9.3