kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Wei Yongjun <weiyongjun1@huawei.com>
Cc: Johan Hovold <johan@kernel.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH -next] gnss: sirf: fix error return code in sirf_probe()
Date: Wed, 13 May 2020 14:53:47 +0000	[thread overview]
Message-ID: <20200513145347.GX25962@localhost> (raw)
In-Reply-To: <20200507094252.13914-1-weiyongjun1@huawei.com>

On Thu, May 07, 2020 at 09:42:52AM +0000, Wei Yongjun wrote:
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: d2efbbd18b1e ("gnss: add driver for sirfstar-based receivers")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/gnss/sirf.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c
> index effed3a8d398..2ecb1d3e8eeb 100644
> --- a/drivers/gnss/sirf.c
> +++ b/drivers/gnss/sirf.c
> @@ -439,14 +439,18 @@ static int sirf_probe(struct serdev_device *serdev)
>  
>  	data->on_off = devm_gpiod_get_optional(dev, "sirf,onoff",
>  			GPIOD_OUT_LOW);
> -	if (IS_ERR(data->on_off))
> +	if (IS_ERR(data->on_off)) {
> +		ret = PTR_ERR(data->on_off);
>  		goto err_put_device;
> +	}
>  
>  	if (data->on_off) {
>  		data->wakeup = devm_gpiod_get_optional(dev, "sirf,wakeup",
>  				GPIOD_IN);
> -		if (IS_ERR(data->wakeup))
> +		if (IS_ERR(data->wakeup)) {
> +			ret = PTR_ERR(data->wakeup);
>  			goto err_put_device;
> +		}
>  
>  		ret = regulator_enable(data->vcc);
>  		if (ret)

Good catch! Now applied with a stable tag as this would lead to a
use-after-free on driver unbind.

Johan

      reply	other threads:[~2020-05-13 14:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07  9:42 [PATCH -next] gnss: sirf: fix error return code in sirf_probe() Wei Yongjun
2020-05-13 14:53 ` Johan Hovold [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=20200513145347.GX25962@localhost \
    --to=johan@kernel.org \
    --cc=hulkci@huawei.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=weiyongjun1@huawei.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 NNTP newsgroup(s).