[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230320063156.31047-2-jiasheng@iscas.ac.cn>
Date: Mon, 20 Mar 2023 14:31:56 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: simon.horman@...igine.com
Cc: marcel@...tmann.org, johan.hedberg@...il.com, luiz.dentz@...il.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, linux-bluetooth@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH 2/2] Bluetooth: 6LoWPAN: Add missing check for skb_clone
Add the check for the return value of skb_clone since it may return NULL
pointer and cause NULL pointer dereference in send_pkt.
Fixes: 18722c247023 ("Bluetooth: Enable 6LoWPAN support for BT LE devices")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
net/bluetooth/6lowpan.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index bd6dbca5747f..3d4ef94405f8 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -475,6 +475,10 @@ static int send_mcast_pkt(struct sk_buff *skb, struct net_device *netdev)
list_for_each_entry_rcu(pentry, &dev->peers, list) {
local_skb = skb_clone(skb, GFP_ATOMIC);
+ if (!local_skb) {
+ err = -ENOMEM;
+ goto out;
+ }
BT_DBG("xmit %s to %pMR type %u IP %pI6c chan %p",
netdev->name,
--
2.25.1
Powered by blists - more mailing lists