Skip to contentSkip to conversation

rsi: Fix a potential memory leak in rsi_send_auto_rate_request()

PATCH RESEND New Christian Engelmayer 1 participant 1 message Apr 10, 2014

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

PATCH RESEND 1/1 rsi: Fix a potential memory leak in rsi_send_auto_rate_request()

Fix a potential memory leak in the error path of function rsi_send_auto_rate_request(). In case memory allocation for array 'selected_rates' fails, the error path exits and leaves the previously allocated skb in place. Detected by Coverity: CID 1195575.

---
Applies against git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git Compile tested.

---
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/rsi/rsi_91x_mgmt.c +1 -0
index 2361a68..dd7946d 100644
@@ -966,6 +966,7 @@ static int rsi_send_auto_rate_request(struct rsi_common *common)
 	if (!selected_rates) {
 		rsi_dbg(ERR_ZONE, "%s: Failed in allocation of mem\n",
 			__func__);
+		dev_kfree_skb(skb);
 		return -ENOMEM;
 	}
 
Signature · 1 line
1.8.3.2