diff mbox series

[BlueZ] profile: add NULL check to ext_remove_records()

Message ID 20240627091628.46304-1-r.smirnov@omp.ru (mailing list archive)
State New, archived
Headers show
Series [BlueZ] profile: add NULL check to ext_remove_records() | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Roman Smirnov June 27, 2024, 9:16 a.m. UTC
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(-)

Comments

bluez.test.bot@gmail.com June 27, 2024, 11:08 a.m. UTC | #1
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
Luiz Augusto von Dentz June 27, 2024, 6:33 p.m. UTC | #2
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
>
>
diff mbox series

Patch

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);
 	}