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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Roman,

On Fri, Jun 28, 2024 at 6:56 AM Roman Smirnov <r.smirnov@xxxxxx> 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





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux