Linux-Bluetooth Archive mirror
 help / color / mirror / Atom feed
From: Sarveshwar Bajaj <sarveshwar.bajaj@nxp.com>
To: linux-bluetooth@vger.kernel.org
Cc: vinit.mehta@nxp.com, devyani.godbole@nxp.com, mahesh.talewad@nxp.com
Subject: [PATCH BlueZ v1 1/1] Fix null pointer deference in bap_get_ascs()
Date: Tue, 23 Apr 2024 13:14:25 +0530	[thread overview]
Message-ID: <20240423074426.62480-1-sarveshwar.bajaj@nxp.com> (raw)

Ensure that bap and rdb pointers are valid before accessing or
allocating memory for ascs. Added  null check to prevent potential
crash
---
 src/shared/bap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 71eadbdb6..0db9ba285 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -1405,7 +1405,7 @@ static bool match_req(const void *data, const void *match_data)
 
 static struct bt_ascs *bap_get_ascs(struct bt_bap *bap)
 {
-	if (!bap)
+	if (!bap || !bap->rdb)
 		return NULL;
 
 	if (bap->rdb->ascs)
-- 
2.21.0.windows.1


             reply	other threads:[~2024-04-23  7:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23  7:44 Sarveshwar Bajaj [this message]
2024-04-23  7:44 ` [PATCH BlueZ v1 0/1] Fix null pointer deference in bap_get_ascs() Sarveshwar Bajaj
2024-04-23  9:40 ` [BlueZ,v1,1/1] " bluez.test.bot
2024-04-29 14:50 ` [PATCH BlueZ v1 1/1] " patchwork-bot+bluetooth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240423074426.62480-1-sarveshwar.bajaj@nxp.com \
    --to=sarveshwar.bajaj@nxp.com \
    --cc=devyani.godbole@nxp.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mahesh.talewad@nxp.com \
    --cc=vinit.mehta@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).