diff mbox series

[BlueZ] bass: add NULL check to bass_handle_add_src_op()

Message ID 20240627085652.41303-1-r.smirnov@omp.ru
State New
Headers show
Series [BlueZ] bass: add NULL check to bass_handle_add_src_op() | expand

Commit Message

Roman Smirnov June 27, 2024, 8:56 a.m. UTC
This prevents a null pointer from being dereferenced in case
queue_find() returns NULL.
---
 src/shared/bass.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com June 27, 2024, 10:43 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=866057

---Test result---

Test Summary:
CheckPatch                    PASS      0.44 seconds
GitLint                       PASS      0.31 seconds
BuildEll                      PASS      24.85 seconds
BluezMake                     PASS      1724.51 seconds
MakeCheck                     PASS      13.36 seconds
MakeDistcheck                 PASS      176.79 seconds
CheckValgrind                 PASS      257.68 seconds
CheckSmatch                   PASS      356.20 seconds
bluezmakeextell               PASS      119.07 seconds
IncrementalBuild              PASS      1575.96 seconds
ScanBuild                     PASS      1008.74 seconds



---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz June 27, 2024, 6:32 p.m. UTC | #2
Hi Roman,

On Thu, Jun 27, 2024 at 5:00 AM Roman Smirnov <r.smirnov@omp.ru> wrote:
>
> This prevents a null pointer from being dereferenced in case
> queue_find() returns NULL.
> ---
>  src/shared/bass.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/shared/bass.c b/src/shared/bass.c
> index c30537dee..f08799714 100644
> --- a/src/shared/bass.c
> +++ b/src/shared/bass.c
> @@ -875,7 +875,8 @@ static void bass_handle_add_src_op(struct bt_bass *bass,
>                                         attr);
>
>                 queue_remove(bass->ldb->bcast_srcs, src);
> -               bass_bcast_src_free(src);
> +               if (src)
> +                       bass_bcast_src_free(src);

I'd move this check inside bass_bcast_src_free to make it safe to pass
NULL pointers.

>                 bcast_src->attr = attr;
>         }
>
> --
> 2.43.0
>
>
diff mbox series

Patch

diff --git a/src/shared/bass.c b/src/shared/bass.c
index c30537dee..f08799714 100644
--- a/src/shared/bass.c
+++ b/src/shared/bass.c
@@ -875,7 +875,8 @@  static void bass_handle_add_src_op(struct bt_bass *bass,
 					attr);
 
 		queue_remove(bass->ldb->bcast_srcs, src);
-		bass_bcast_src_free(src);
+		if (src)
+			bass_bcast_src_free(src);
 		bcast_src->attr = attr;
 	}