The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2] Bluetooth: Add check for mgmt_alloc_skb() in mgmt_remote_name()
@ 2025-02-21  8:49 Haoxiang Li
  2025-02-24 21:10 ` patchwork-bot+bluetooth
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2025-02-21  8:49 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz, mm, acz, rad
  Cc: linux-bluetooth, linux-kernel, Haoxiang Li, stable

Add check for the return value of mgmt_alloc_skb() in
mgmt_remote_name() to prevent null pointer dereference.

Fixes: ba17bb62ce41 ("Bluetooth: Fix skb allocation in mgmt_remote_name() & mgmt_device_connected()")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
Changes in v2:
- modify the title description.
---
 net/bluetooth/mgmt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index f53304cb09db..3e0f88cd975c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -10413,6 +10413,8 @@ void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
 
 	skb = mgmt_alloc_skb(hdev, MGMT_EV_DEVICE_FOUND,
 			     sizeof(*ev) + (name ? eir_precalc_len(name_len) : 0));
+	if (!skb)
+		return;
 
 	ev = skb_put(skb, sizeof(*ev));
 	bacpy(&ev->addr.bdaddr, bdaddr);
-- 
2.25.1


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

* Re: [PATCH v2] Bluetooth: Add check for mgmt_alloc_skb() in mgmt_remote_name()
  2025-02-21  8:49 [PATCH v2] Bluetooth: Add check for mgmt_alloc_skb() in mgmt_remote_name() Haoxiang Li
@ 2025-02-24 21:10 ` patchwork-bot+bluetooth
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2025-02-24 21:10 UTC (permalink / raw)
  To: Haoxiang Li
  Cc: marcel, johan.hedberg, luiz.dentz, mm, acz, rad, linux-bluetooth,
	linux-kernel, stable

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri, 21 Feb 2025 16:49:47 +0800 you wrote:
> Add check for the return value of mgmt_alloc_skb() in
> mgmt_remote_name() to prevent null pointer dereference.
> 
> Fixes: ba17bb62ce41 ("Bluetooth: Fix skb allocation in mgmt_remote_name() & mgmt_device_connected()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> 
> [...]

Here is the summary with links:
  - [v2] Bluetooth: Add check for mgmt_alloc_skb() in mgmt_remote_name()
    https://git.kernel.org/bluetooth/bluetooth-next/c/62ee156d6b29

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-02-24 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-21  8:49 [PATCH v2] Bluetooth: Add check for mgmt_alloc_skb() in mgmt_remote_name() Haoxiang Li
2025-02-24 21:10 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox