mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Slavin Liu <bolin.liu@seu.edu.cn>
To: andersson@kernel.org, mathieu.poirier@linaro.org
Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org,
	linux-kernel@vger.kernel.org, bolin.liu@seu.edu.cn
Subject: [PATCH RFC] rpmsg: qcom_smd: reject interrupted channel waits
Date: Fri, 11 Sep 2026 14:09:20 +0800	[thread overview]
Message-ID: <20260911060920.94363-1-bolin.liu@seu.edu.cn> (raw)

qcom_smd_create_ept() waits for a channel using
wait_event_interruptible_timeout(). If a signal interrupts the wait
before the named channel appears, the wait returns -ERESTARTSYS and
channel is still NULL. The current zero-only test treats the negative
return as success and then dereferences channel->state.

Require a positive wait result before using the channel. Return NULL for
interruption as for a timeout, following the endpoint creation API's
existing failure convention. No endpoint or channel resources have been
acquired at this point, and the successful wait path is unchanged.

Detected by static analysis and reviewed with AI-assisted source auditing.

Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend")
Assisted-by: LLM
Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
---
 drivers/rpmsg/qcom_smd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
index 7dbe1c6efe41..7bbd29707f78 100644
--- a/drivers/rpmsg/qcom_smd.c
+++ b/drivers/rpmsg/qcom_smd.c
@@ -914,7 +914,7 @@ static struct rpmsg_endpoint *qcom_smd_create_ept(struct rpmsg_device *rpdev,
 	ret = wait_event_interruptible_timeout(edge->new_channel_event,
 			(channel = qcom_smd_find_channel(edge, name)) != NULL,
 			HZ);
-	if (!ret)
+	if (ret <= 0)
 		return NULL;
 
 	if (channel->state != SMD_CHANNEL_CLOSED) {

             reply	other threads:[~2026-09-11  6:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11  6:09 Slavin Liu [this message]
2026-09-21 12:28 ` Konrad Dybcio

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=20260911060920.94363-1-bolin.liu@seu.edu.cn \
    --to=bolin.liu@seu.edu.cn \
    --cc=andersson@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.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

all inboxes | Powered by JetHome®