diff mbox series

[BlueZ,v1] a2dp: add NULL check to a2dp_reconfig()

Message ID 20240628105521.540629-1-r.smirnov@omp.ru (mailing list archive)
State New, archived
Headers show
Series [BlueZ,v1] a2dp: add NULL check to a2dp_reconfig() | 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 28, 2024, 10:55 a.m. UTC
Add chan->session check for NULL before dereferencing.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
---
 profiles/audio/a2dp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com June 28, 2024, 12:40 p.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=866533

---Test result---

Test Summary:
CheckPatch                    PASS      5.06 seconds
GitLint                       PASS      0.53 seconds
BuildEll                      PASS      24.76 seconds
BluezMake                     PASS      1729.03 seconds
MakeCheck                     PASS      13.00 seconds
MakeDistcheck                 PASS      180.18 seconds
CheckValgrind                 PASS      255.67 seconds
CheckSmatch                   PASS      359.16 seconds
bluezmakeextell               PASS      122.04 seconds
IncrementalBuild              PASS      1502.11 seconds
ScanBuild                     PASS      1031.31 seconds



---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz June 28, 2024, 1:55 p.m. UTC | #2
Hi Roman,

On Fri, Jun 28, 2024 at 6:56 AM Roman Smirnov <r.smirnov@omp.ru> wrote:
>
> Add chan->session check for NULL before dereferencing.
>
> Found by Linux Verification Center (linuxtesting.org) with the SVACE
> static analysis tool.
> ---
>  profiles/audio/a2dp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
> index a3c294bc3..3f9deb9f8 100644
> --- a/profiles/audio/a2dp.c
> +++ b/profiles/audio/a2dp.c
> @@ -1893,7 +1893,8 @@ static int a2dp_reconfig(struct a2dp_channel *chan, const char *sender,
>                         }
>
>                         /* Check if stream is for the channel */
> -                       if (!avdtp_has_stream(chan->session, tmp->stream))
> +                       if (!chan->session ||
> +                               !avdtp_has_stream(chan->session, tmp->stream))
>                                 continue;

Move the check for !session inside avdtp_has_stream.

>                         err = avdtp_close(chan->session, tmp->stream, FALSE);
> --
> 2.43.0
>
>
diff mbox series

Patch

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index a3c294bc3..3f9deb9f8 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1893,7 +1893,8 @@  static int a2dp_reconfig(struct a2dp_channel *chan, const char *sender,
 			}
 
 			/* Check if stream is for the channel */
-			if (!avdtp_has_stream(chan->session, tmp->stream))
+			if (!chan->session ||
+				!avdtp_has_stream(chan->session, tmp->stream))
 				continue;
 
 			err = avdtp_close(chan->session, tmp->stream, FALSE);