diff mbox series

drivers/net: fix a null-ptr-deref bug in drivers/net/wireless/marvell/mwifiex/uap_txrx.c

Message ID 20201209132640.36031-1-tzh18@mails.tsinghua.edu.cn
State New
Headers show
Series drivers/net: fix a null-ptr-deref bug in drivers/net/wireless/marvell/mwifiex/uap_txrx.c | expand

Commit Message

tangzhenhao Dec. 9, 2020, 1:26 p.m. UTC
At line 257 in drivers/net/wireless/marvell/mwifiex/uap_txrx.c, the ret-val of skb_copy should be checked to avoid null-ptr-deref bug.

Signed-off-by: tangzhenhao <tzh18@mails.tsinghua.edu.cn>
---
 drivers/net/wireless/marvell/mwifiex/uap_txrx.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Kalle Valo Dec. 17, 2020, 4:33 p.m. UTC | #1
tangzhenhao <tzh18@mails.tsinghua.edu.cn> wrote:

> At line 257 in drivers/net/wireless/marvell/mwifiex/uap_txrx.c, the ret-val of skb_copy should be checked to avoid null-ptr-deref bug.

> 

> Signed-off-by: tangzhenhao <tzh18@mails.tsinghua.edu.cn>


The title does not use the correct format and the commit log is not word
wrapped.

Patch set to Changes Requested.

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20201209132640.36031-1-tzh18@mails.tsinghua.edu.cn/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Zhi Han Jan. 3, 2021, 8:20 a.m. UTC | #2
tangzhenhao <tzh18@mails.tsinghua.edu.cn> wrote:

> At line 257 in drivers/net/wireless/marvell/mwifiex/uap_txrx.c, the ret-val of skb_copy should be checked to avoid null-ptr-deref bug.

>

> Signed-off-by: tangzhenhao <tzh18@mails.tsinghua.edu.cn>


"\n" should be added at the end of message to avoid corrupting other logs
and to output timely.
diff mbox series

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/uap_txrx.c b/drivers/net/wireless/marvell/mwifiex/uap_txrx.c
index 9bbdb8dfce62..d89311851594 100644
--- a/drivers/net/wireless/marvell/mwifiex/uap_txrx.c
+++ b/drivers/net/wireless/marvell/mwifiex/uap_txrx.c
@@ -255,6 +255,11 @@  int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv,
 
 	if (is_multicast_ether_addr(ra)) {
 		skb_uap = skb_copy(skb, GFP_ATOMIC);
+		if (!likely(skb_uap)) {
+			mwifiex_dbg(adapter, ERROR, "failed to allocate skb_uap");
+			dev_kfree_skb_any(skb);
+			return 0;
+		}
 		mwifiex_uap_queue_bridged_pkt(priv, skb_uap);
 	} else {
 		if (mwifiex_get_sta_entry(priv, ra)) {