public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] profile: add NULL check to ext_remove_records()
@ 2024-06-27  9:16 Roman Smirnov
  2024-06-27 11:08 ` [BlueZ] " bluez.test.bot
  2024-06-27 18:33 ` [PATCH BlueZ] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Roman Smirnov @ 2024-06-27  9:16 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Roman Smirnov

Add a NULL check to prevent dereferencing a null pointer in
case the adapter is NULL
---
 src/profile.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/profile.c b/src/profile.c
index c62224af9..bb988e8cb 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -1507,7 +1507,8 @@ static void ext_remove_records(struct ext_profile *ext,
 
 		ext->records = g_slist_remove(ext->records, r);
 
-		adapter_service_remove(adapter, r->handle);
+		if (adapter)
+			adapter_service_remove(adapter, r->handle);
 		btd_adapter_unref(r->adapter);
 		g_free(r);
 	}
-- 
2.43.0


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

* RE: [BlueZ] profile: add NULL check to ext_remove_records()
  2024-06-27  9:16 [PATCH BlueZ] profile: add NULL check to ext_remove_records() Roman Smirnov
@ 2024-06-27 11:08 ` bluez.test.bot
  2024-06-27 18:33 ` [PATCH BlueZ] " Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-06-27 11:08 UTC (permalink / raw)
  To: linux-bluetooth, r.smirnov

[-- Attachment #1: Type: text/plain, Size: 949 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=866066

---Test result---

Test Summary:
CheckPatch                    PASS      0.97 seconds
GitLint                       PASS      0.19 seconds
BuildEll                      PASS      25.09 seconds
BluezMake                     PASS      1786.27 seconds
MakeCheck                     PASS      13.52 seconds
MakeDistcheck                 PASS      184.71 seconds
CheckValgrind                 PASS      259.64 seconds
CheckSmatch                   PASS      362.96 seconds
bluezmakeextell               PASS      122.90 seconds
IncrementalBuild              PASS      1668.12 seconds
ScanBuild                     PASS      1065.72 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ] profile: add NULL check to ext_remove_records()
  2024-06-27  9:16 [PATCH BlueZ] profile: add NULL check to ext_remove_records() Roman Smirnov
  2024-06-27 11:08 ` [BlueZ] " bluez.test.bot
@ 2024-06-27 18:33 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2024-06-27 18:33 UTC (permalink / raw)
  To: Roman Smirnov; +Cc: linux-bluetooth

Hi Roman,

On Thu, Jun 27, 2024 at 5:17 AM Roman Smirnov <r.smirnov@omp.ru> wrote:
>
> Add a NULL check to prevent dereferencing a null pointer in
> case the adapter is NULL
> ---
>  src/profile.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/profile.c b/src/profile.c
> index c62224af9..bb988e8cb 100644
> --- a/src/profile.c
> +++ b/src/profile.c
> @@ -1507,7 +1507,8 @@ static void ext_remove_records(struct ext_profile *ext,
>
>                 ext->records = g_slist_remove(ext->records, r);
>
> -               adapter_service_remove(adapter, r->handle);
> +               if (adapter)
> +                       adapter_service_remove(adapter, r->handle);

I'd move this check inside adapter_service_remove to make it safe to
pass NULL pointers as adapter.

>                 btd_adapter_unref(r->adapter);
>                 g_free(r);
>         }
> --
> 2.43.0
>
>


-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2024-06-27 18:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27  9:16 [PATCH BlueZ] profile: add NULL check to ext_remove_records() Roman Smirnov
2024-06-27 11:08 ` [BlueZ] " bluez.test.bot
2024-06-27 18:33 ` [PATCH BlueZ] " 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