All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: 6LoWPAN: Add missing check for skb_clone
@ 2023-03-13  9:03 Jiasheng Jiang
  2023-03-13  9:34 ` bluez.test.bot
  2023-03-14 14:58 ` [PATCH] " Simon Horman
  0 siblings, 2 replies; 3+ messages in thread
From: Jiasheng Jiang @ 2023-03-13  9:03 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz, davem, edumazet, kuba, pabeni
  Cc: linux-bluetooth, netdev, linux-kernel, Jiasheng Jiang

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@iscas.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 4eb1b3ced0d2..bf42a0b03e20 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -477,6 +477,10 @@ static int send_mcast_pkt(struct sk_buff *skb, struct net_device *netdev)
 			int ret;
 
 			local_skb = skb_clone(skb, GFP_ATOMIC);
+			if (!local_skb) {
+				rcu_read_unlock();
+				return -ENOMEM;
+			}
 
 			BT_DBG("xmit %s to %pMR type %u IP %pI6c chan %p",
 			       netdev->name,
-- 
2.25.1


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

end of thread, other threads:[~2023-03-14 14:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-13  9:03 [PATCH] Bluetooth: 6LoWPAN: Add missing check for skb_clone Jiasheng Jiang
2023-03-13  9:34 ` bluez.test.bot
2023-03-14 14:58 ` [PATCH] " Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.