Skip to contentSkip to conversation

cxgb4: fix memory leak on txq_info

PATCH In review Colin King 2 participants 3 messages Nov 23, 2016 – Nov 25, 2016

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 cxgb4: fix memory leak on txq_info

From: Colin Ian King <[email protected]>

Currently if txq_info->uldtxq cannot be allocated then txq_info->txq is being kfree'd (which is redundant because it is NULL) instead of txq_info. Fix this by instead kfree'ing txq_info.

---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c +1 -1
index 565a6c6..8098902 100644
@@ -532,7 +532,7 @@ setup_sge_txq_uld(struct adapter *adap, unsigned int uld_type,
 	txq_info->uldtxq = kcalloc(txq_info->ntxq, sizeof(struct sge_uld_txq),
 				   GFP_KERNEL);
 	if (!txq_info->uldtxq) {
-		kfree(txq_info->uldtxq);
+		kfree(txq_info);
 		return -ENOMEM;
 	}
 
Signature · 1 line
2.10.2
maintainer
#1 lore raw

From: Colin King <[email protected]>
Date: Wed, 23 Nov 2016 11:02:44 +0000

Quoted 8 lines

From: Colin Ian King <[email protected]>

Currently if txq_info->uldtxq cannot be allocated then txq_info->txq is being kfree'd (which is redundant because it is NULL) instead of txq_info. Fix this by instead kfree'ing txq_info.

Applied, but Colin you _really_ need to start properly marking your networking patch submissions by indicating in the subject which tree your change is for. In this case I figured out it was net-next, but you must say this explicitly in the Subject line via "Subject: [PATCH net-next] ..."

Thanks.

#2 lore raw
Quoted 12 lines · David Miller

From: Colin King <[email protected]>
Date: Wed, 23 Nov 2016 11:02:44 +0000

Quoted 8 lines

From: Colin Ian King <[email protected]>

Currently if txq_info->uldtxq cannot be allocated then txq_info->txq is being kfree'd (which is redundant because it is NULL) instead of txq_info. Fix this by instead kfree'ing txq_info.

Quoted 8 lines

Applied, but Colin you _really_ need to start properly marking your networking patch submissions by indicating in the subject which tree your change is for. In this case I figured out it was net-next, but you must say this explicitly in the Subject line via "Subject: [PATCH net-next] ..."

Thanks.

Understood, will do next time, apologies for that.

Colin