public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] a2dp: add NULL check to a2dp_reconfig()
@ 2024-06-28 10:55 Roman Smirnov
  2024-06-28 12:40 ` [BlueZ,v1] " bluez.test.bot
  2024-06-28 13:55 ` [PATCH BlueZ v1] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Roman Smirnov @ 2024-06-28 10:55 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Roman Smirnov

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;
 
 			err = avdtp_close(chan->session, tmp->stream, FALSE);
-- 
2.43.0


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

* RE: [BlueZ,v1] a2dp: add NULL check to a2dp_reconfig()
  2024-06-28 10:55 [PATCH BlueZ v1] a2dp: add NULL check to a2dp_reconfig() Roman Smirnov
@ 2024-06-28 12:40 ` bluez.test.bot
  2024-06-28 13:55 ` [PATCH BlueZ v1] " Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-06-28 12:40 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=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


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

* Re: [PATCH BlueZ v1] a2dp: add NULL check to a2dp_reconfig()
  2024-06-28 10:55 [PATCH BlueZ v1] a2dp: add NULL check to a2dp_reconfig() Roman Smirnov
  2024-06-28 12:40 ` [BlueZ,v1] " bluez.test.bot
@ 2024-06-28 13:55 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2024-06-28 13:55 UTC (permalink / raw)
  To: Roman Smirnov; +Cc: linux-bluetooth

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
>
>


-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2024-06-28 13:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28 10:55 [PATCH BlueZ v1] a2dp: add NULL check to a2dp_reconfig() Roman Smirnov
2024-06-28 12:40 ` [BlueZ,v1] " bluez.test.bot
2024-06-28 13:55 ` [PATCH BlueZ v1] " 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