Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Bjorn Andersson <quic_bjorande@quicinc.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Sarannya S <quic_sarannya@quicinc.com>,
	Chris Lew <quic_clew@quicinc.com>,
	Deepak Kumar Singh <quic_deesin@quicinc.com>,
	linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel test robot <lkp@intel.com>,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH] rpmsg: glink: Avoid dereferencing NULL channel
Date: Tue, 18 Jul 2023 10:23:21 -0600	[thread overview]
Message-ID: <ZLa8eRptI/21au0k@p14s> (raw)
In-Reply-To: <20230717165538.1542034-1-quic_bjorande@quicinc.com>

On Mon, Jul 17, 2023 at 09:55:38AM -0700, Bjorn Andersson wrote:
> 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@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202307160800.sb7gMnL6-lkp@intel.com/
> Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.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;
> +	}

I have applied this patch.

Thanks,
Mathieu

>  
>  	enable = sigs & NATIVE_DSR_SIG || sigs & NATIVE_CTS_SIG;
>  
> -- 
> 2.25.1
> 

      reply	other threads:[~2023-07-18 16:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 16:55 [PATCH] rpmsg: glink: Avoid dereferencing NULL channel Bjorn Andersson
2023-07-18 16:23 ` Mathieu Poirier [this message]

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=ZLa8eRptI/21au0k@p14s \
    --to=mathieu.poirier@linaro.org \
    --cc=andersson@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=quic_bjorande@quicinc.com \
    --cc=quic_clew@quicinc.com \
    --cc=quic_deesin@quicinc.com \
    --cc=quic_sarannya@quicinc.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