diff mbox series

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

Message ID 20240628105521.540629-1-r.smirnov@omp.ru
State New
Headers show
Series [BlueZ,v1] a2dp: add NULL check to a2dp_reconfig() | expand

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(-)
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);