diff mbox series

[net] rsi: Add a NULL check in rsi_core_xmit

Message ID 1619794016-27348-1-git-send-email-wangyunjian@huawei.com
State New
Headers show
Series [net] rsi: Add a NULL check in rsi_core_xmit | expand

Commit Message

wangyunjian April 30, 2021, 2:46 p.m. UTC
From: Yunjian Wang <wangyunjian@huawei.com>

The skb may be NULL in rsi_core_xmit(). Add a check to avoid
dereferencing null pointer.

Addresses-Coverity: ("Dereference after null check")
Fixes: dad0d04fa7ba ("rsi: Add RS9113 wireless driver")
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/wireless/rsi/rsi_91x_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/rsi/rsi_91x_core.c b/drivers/net/wireless/rsi/rsi_91x_core.c
index a48e616e0fb9..436e7b30d159 100644
--- a/drivers/net/wireless/rsi/rsi_91x_core.c
+++ b/drivers/net/wireless/rsi/rsi_91x_core.c
@@ -492,5 +492,6 @@  void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb)
 xmit_fail:
 	rsi_dbg(ERR_ZONE, "%s: Failed to queue packet\n", __func__);
 	/* Dropping pkt here */
-	ieee80211_free_txskb(common->priv->hw, skb);
+	if (skb)
+		ieee80211_free_txskb(common->priv->hw, skb);
 }