* [PATCH] Add Null Pointer Checks
@ 2026-02-01 8:46 Roushan Kumar Singh
2026-02-01 9:46 ` bluez.test.bot
2026-02-03 21:51 ` [PATCH] " Luiz Augusto von Dentz
0 siblings, 2 replies; 3+ messages in thread
From: Roushan Kumar Singh @ 2026-02-01 8:46 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Roushan Kumar Singh
---
src/device.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/device.c b/src/device.c
index af8df5f29..c0b95d09c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -380,6 +380,9 @@ static GSList *find_service_with_uuid(GSList *list, char *uuid)
struct btd_service *service = l->data;
struct btd_profile *profile = btd_service_get_profile(service);
+ if (!profile || !profile->remote_uuid)
+ continue;
+
if (bt_uuid_strcmp(profile->remote_uuid, uuid) == 0)
return l;
}
@@ -2540,7 +2543,7 @@ static struct btd_service *find_connectable_service(struct btd_device *dev,
struct btd_service *service = l->data;
struct btd_profile *p = btd_service_get_profile(service);
- if (!p->connect || !p->remote_uuid)
+ if (!p || !p->connect || !p->remote_uuid)
continue;
if (strcasecmp(uuid, p->remote_uuid) == 0)
@@ -2594,6 +2597,9 @@ void btd_device_update_allowed_services(struct btd_device *dev)
service = l->data;
profile = btd_service_get_profile(service);
+ if (!profile || !profile->remote_uuid)
+ continue;
+
is_allowed = btd_adapter_is_uuid_allowed(adapter,
profile->remote_uuid);
btd_service_set_allowed(service, is_allowed);
@@ -2629,11 +2635,12 @@ static GSList *create_pending_list(struct btd_device *dev, const char *uuid)
service = l->data;
p = btd_service_get_profile(service);
- if (!p->auto_connect)
+ if (!p || !p->auto_connect)
continue;
if (!btd_service_is_allowed(service)) {
- info("service %s is blocked", p->remote_uuid);
+ if (p->remote_uuid)
+ info("service %s is blocked", p->remote_uuid);
continue;
}
@@ -6173,8 +6180,8 @@ static void disconnect_gatt_service(gpointer data, gpointer user_data)
struct btd_service *service = data;
struct btd_profile *profile = btd_service_get_profile(service);
- /* Ignore if profile cannot accept connections */
- if (!profile->accept)
+ /* Ignore if profile is NULL or cannot accept connections */
+ if (!profile || !profile->accept)
return;
btd_service_disconnect(service);
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Add Null Pointer Checks
2026-02-01 8:46 [PATCH] Add Null Pointer Checks Roushan Kumar Singh
@ 2026-02-01 9:46 ` bluez.test.bot
2026-02-03 21:51 ` [PATCH] " Luiz Augusto von Dentz
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-02-01 9:46 UTC (permalink / raw)
To: linux-bluetooth, github.rtron18
[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1049427
---Test result---
Test Summary:
CheckPatch PENDING 0.40 seconds
GitLint PENDING 0.42 seconds
BuildEll PASS 19.88 seconds
BluezMake PASS 650.91 seconds
MakeCheck PASS 18.51 seconds
MakeDistcheck PASS 242.66 seconds
CheckValgrind PASS 293.92 seconds
CheckSmatch PASS 348.58 seconds
bluezmakeextell PASS 182.42 seconds
IncrementalBuild PENDING 0.38 seconds
ScanBuild PASS 1000.60 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add Null Pointer Checks
2026-02-01 8:46 [PATCH] Add Null Pointer Checks Roushan Kumar Singh
2026-02-01 9:46 ` bluez.test.bot
@ 2026-02-03 21:51 ` Luiz Augusto von Dentz
1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2026-02-03 21:51 UTC (permalink / raw)
To: Roushan Kumar Singh; +Cc: linux-bluetooth
Hi Roushan,
Could please add the backtrace so we can check this actually
reproducible, afaik the likes of service_create are only called with
non-NULL profile, but maybe this is the result of the service being
removed or something that resets service->profile to NULL but in that
case the service should be invalidate as well and removed from the
list of services.
On Sun, Feb 1, 2026 at 3:55 AM Roushan Kumar Singh
<github.rtron18@gmail.com> wrote:
>
> ---
> src/device.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/src/device.c b/src/device.c
> index af8df5f29..c0b95d09c 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -380,6 +380,9 @@ static GSList *find_service_with_uuid(GSList *list, char *uuid)
> struct btd_service *service = l->data;
> struct btd_profile *profile = btd_service_get_profile(service);
>
> + if (!profile || !profile->remote_uuid)
> + continue;
> +
> if (bt_uuid_strcmp(profile->remote_uuid, uuid) == 0)
> return l;
> }
> @@ -2540,7 +2543,7 @@ static struct btd_service *find_connectable_service(struct btd_device *dev,
> struct btd_service *service = l->data;
> struct btd_profile *p = btd_service_get_profile(service);
>
> - if (!p->connect || !p->remote_uuid)
> + if (!p || !p->connect || !p->remote_uuid)
> continue;
>
> if (strcasecmp(uuid, p->remote_uuid) == 0)
> @@ -2594,6 +2597,9 @@ void btd_device_update_allowed_services(struct btd_device *dev)
> service = l->data;
> profile = btd_service_get_profile(service);
>
> + if (!profile || !profile->remote_uuid)
> + continue;
> +
> is_allowed = btd_adapter_is_uuid_allowed(adapter,
> profile->remote_uuid);
> btd_service_set_allowed(service, is_allowed);
> @@ -2629,11 +2635,12 @@ static GSList *create_pending_list(struct btd_device *dev, const char *uuid)
> service = l->data;
> p = btd_service_get_profile(service);
>
> - if (!p->auto_connect)
> + if (!p || !p->auto_connect)
> continue;
>
> if (!btd_service_is_allowed(service)) {
> - info("service %s is blocked", p->remote_uuid);
> + if (p->remote_uuid)
> + info("service %s is blocked", p->remote_uuid);
> continue;
> }
>
> @@ -6173,8 +6180,8 @@ static void disconnect_gatt_service(gpointer data, gpointer user_data)
> struct btd_service *service = data;
> struct btd_profile *profile = btd_service_get_profile(service);
>
> - /* Ignore if profile cannot accept connections */
> - if (!profile->accept)
> + /* Ignore if profile is NULL or cannot accept connections */
> + if (!profile || !profile->accept)
> return;
>
> btd_service_disconnect(service);
> --
> 2.51.0
>
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-03 21:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-01 8:46 [PATCH] Add Null Pointer Checks Roushan Kumar Singh
2026-02-01 9:46 ` bluez.test.bot
2026-02-03 21:51 ` [PATCH] " Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox