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

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