netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Bluetooth: msft: fix null pointer deref on msft_monitor_device_evt
@ 2022-01-23  5:57 Soenke Huster
  2022-01-23 14:30 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Soenke Huster @ 2022-01-23  5:57 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	David S. Miller, Jakub Kicinski
  Cc: Soenke Huster, linux-bluetooth, netdev, linux-kernel

msft_find_handle_data returns NULL if it can't find the handle.
Therefore, handle_data must be checked, otherwise a null pointer
is dereferenced.

Signed-off-by: Soenke Huster <soenke.huster@eknoes.de>
---
v2: Remove empty line

 net/bluetooth/msft.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index 484540855863..9a3d77d3ca86 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -704,6 +704,8 @@ static void msft_monitor_device_evt(struct hci_dev *hdev, struct sk_buff *skb)
 		   ev->monitor_state, &ev->bdaddr);
 
 	handle_data = msft_find_handle_data(hdev, ev->monitor_handle, false);
+	if (!handle_data)
+		return;
 
 	switch (ev->addr_type) {
 	case ADDR_LE_DEV_PUBLIC:
-- 
2.34.1


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

* Re: [PATCH v2] Bluetooth: msft: fix null pointer deref on msft_monitor_device_evt
  2022-01-23  5:57 [PATCH v2] Bluetooth: msft: fix null pointer deref on msft_monitor_device_evt Soenke Huster
@ 2022-01-23 14:30 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2022-01-23 14:30 UTC (permalink / raw)
  To: Soenke Huster
  Cc: Johan Hedberg, Luiz Augusto von Dentz, David S. Miller,
	Jakub Kicinski, BlueZ, open list:NETWORKING [GENERAL],
	linux-kernel

Hi Soenke,

> msft_find_handle_data returns NULL if it can't find the handle.
> Therefore, handle_data must be checked, otherwise a null pointer
> is dereferenced.
> 
> Signed-off-by: Soenke Huster <soenke.huster@eknoes.de>
> ---
> v2: Remove empty line
> 
> net/bluetooth/msft.c | 2 ++
> 1 file changed, 2 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2022-01-23 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-23  5:57 [PATCH v2] Bluetooth: msft: fix null pointer deref on msft_monitor_device_evt Soenke Huster
2022-01-23 14:30 ` Marcel Holtmann

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 NNTP newsgroup(s).