public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] core: add NULL check to adapter_service_remove()
@ 2024-06-28 10:30 Roman Smirnov
  2024-06-28 12:04 ` [BlueZ,v1] " bluez.test.bot
  2024-06-28 15:10 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 4+ messages in thread
From: Roman Smirnov @ 2024-06-28 10:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Roman Smirnov

Make adapter_service_remove() safe for passing NULL pointers.
---
 src/adapter.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index bdc5bf920..57e4dcd54 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1349,6 +1349,10 @@ int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec)
 void adapter_service_remove(struct btd_adapter *adapter, uint32_t handle)
 {
 	sdp_record_t *rec;
+
+	if (!adapter)
+		return;
+
 	/*
 	 * If the controller does not support BR/EDR operation,
 	 * there is no point in trying to remote SDP records.
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH BlueZ v1] core: add NULL check to adapter_service_remove()
@ 2024-06-28  7:47 Roman Smirnov
  2024-06-28  9:42 ` [BlueZ,v1] " bluez.test.bot
  0 siblings, 1 reply; 4+ messages in thread
From: Roman Smirnov @ 2024-06-28  7:47 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Roman Smirnov

Make adapter_service_remove() safe for passing NULL pointers.
---
 src/adapter.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index bdc5bf920..57e4dcd54 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1349,6 +1349,10 @@ int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec)
 void adapter_service_remove(struct btd_adapter *adapter, uint32_t handle)
 {
 	sdp_record_t *rec;
+	
+	if (!adapter)
+		return;
+
 	/*
 	 * If the controller does not support BR/EDR operation,
 	 * there is no point in trying to remote SDP records.
-- 
2.43.0


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

end of thread, other threads:[~2024-06-28 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28 10:30 [PATCH BlueZ v1] core: add NULL check to adapter_service_remove() Roman Smirnov
2024-06-28 12:04 ` [BlueZ,v1] " bluez.test.bot
2024-06-28 15:10 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  -- strict thread matches above, loose matches on Subject: below --
2024-06-28  7:47 Roman Smirnov
2024-06-28  9:42 ` [BlueZ,v1] " bluez.test.bot

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