Netdev Archive mirror
 help / color / mirror / Atom feed
* [PATCH net] rsi: Add a NULL check in rsi_core_xmit
@ 2021-04-30 14:46 wangyunjian
  2021-04-30 14:59 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: wangyunjian @ 2021-04-30 14:46 UTC (permalink / raw
  To: kuba, davem
  Cc: amitkarwar, siva8118, linux-wireless, netdev, dingxiaoxiong,
	Yunjian Wang

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 --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);
 }
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] rsi: Add a NULL check in rsi_core_xmit
  2021-04-30 14:46 [PATCH net] rsi: Add a NULL check in rsi_core_xmit wangyunjian
@ 2021-04-30 14:59 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2021-04-30 14:59 UTC (permalink / raw
  To: wangyunjian, kuba, davem
  Cc: amitkarwar, siva8118, linux-wireless, netdev, dingxiaoxiong

On Fri, 2021-04-30 at 22:46 +0800, wangyunjian wrote:
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> The skb may be NULL in rsi_core_xmit().

How so?

Static checkers are good. Coverity is one of the better ones, in my
experience. But blindly believing static checkers still isn't good.

I see why the static checker is confused, but really, _you_ should have
done that work, not me.

johannes


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-30 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-30 14:46 [PATCH net] rsi: Add a NULL check in rsi_core_xmit wangyunjian
2021-04-30 14:59 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).