[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230717165538.1542034-1-quic_bjorande@quicinc.com>
Date: Mon, 17 Jul 2023 09:55:38 -0700
From: Bjorn Andersson <quic_bjorande@...cinc.com>
To: Bjorn Andersson <andersson@...nel.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Sarannya S <quic_sarannya@...cinc.com>,
"Chris Lew" <quic_clew@...cinc.com>
CC: Deepak Kumar Singh <quic_deesin@...cinc.com>,
<linux-arm-msm@...r.kernel.org>,
<linux-remoteproc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
kernel test robot <lkp@...el.com>,
"Dan Carpenter" <dan.carpenter@...aro.org>
Subject: [PATCH] rpmsg: glink: Avoid dereferencing NULL channel
The newly introduced signal command handler checks for non-existing
channel and print an error message, but then continues on to dereference
that same channel.
Instead abort the handler when no channel is found.
Fixes: a2b73aa512a4 ("rpmsg: glink: Add support to handle signals command")
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Closes: https://lore.kernel.org/r/202307160800.sb7gMnL6-lkp@intel.com/
Signed-off-by: Bjorn Andersson <quic_bjorande@...cinc.com>
---
drivers/rpmsg/qcom_glink_native.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index e10c05ed21bb..82d460ff4777 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1070,8 +1070,10 @@ static void qcom_glink_handle_signals(struct qcom_glink *glink,
spin_lock_irqsave(&glink->idr_lock, flags);
channel = idr_find(&glink->rcids, rcid);
spin_unlock_irqrestore(&glink->idr_lock, flags);
- if (!channel)
+ if (!channel) {
dev_err(glink->dev, "signal for non-existing channel\n");
+ return;
+ }
enable = sigs & NATIVE_DSR_SIG || sigs & NATIVE_CTS_SIG;
--
2.25.1
Powered by blists - more mailing lists