From: Anas Iqbal <mohd.abd.6602@gmail.com>
To: srini@kernel.org
Cc: gregkh@linuxfoundation.org, vkoul@kernel.org,
linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org,
Anas Iqbal <mohd.abd.6602@gmail.com>
Subject: [PATCH] slimbus: qcom-ngd: fix NULL pointer dereference in qcom_slim_ngd_xfer_msg()
Date: Sun, 22 Mar 2026 12:46:47 +0000 [thread overview]
Message-ID: <20260322124647.4246-1-mohd.abd.6602@gmail.com> (raw)
txn->msg is dereferenced without a prior NULL check in
qcom_slim_ngd_xfer_msg(), which may lead to a NULL pointer
dereference.
Although current callers initialize txn->msg, add a defensive
check to prevent potential crashes if a NULL pointer is passed.
Fixes: 917809e2280bb ("slimbus: ngd: Add qcom SLIMBus NGD driver")
Signed-off-by: Anas Iqbal <mohd.abd.6602@gmail.com>
---
drivers/slimbus/qcom-ngd-ctrl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index 9aa7218b4e8d..241f5e08b582 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -805,6 +805,9 @@ static int qcom_slim_ngd_xfer_msg(struct slim_controller *sctrl,
if (txn->dt == SLIM_MSG_DEST_ENUMADDR)
return -EPROTONOSUPPORT;
+ if (!txn->msg)
+ return -EINVAL;
+
if (txn->msg->num_bytes > SLIM_MSGQ_BUF_LEN ||
txn->rl > SLIM_MSGQ_BUF_LEN) {
dev_err(ctrl->dev, "msg exceeds HW limit\n");
--
2.43.0
next reply other threads:[~2026-03-22 12:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-22 12:46 Anas Iqbal [this message]
2026-03-24 0:24 ` [PATCH] slimbus: qcom-ngd: fix NULL pointer dereference in qcom_slim_ngd_xfer_msg() Dmitry Baryshkov
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=20260322124647.4246-1-mohd.abd.6602@gmail.com \
--to=mohd.abd.6602@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=srini@kernel.org \
--cc=vkoul@kernel.org \
/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