All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] gnss: sirf: fix error return code in sirf_probe()
@ 2020-05-07  9:42 ` Wei Yongjun
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Yongjun @ 2020-05-07  9:42 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Wei Yongjun, linux-kernel, kernel-janitors, Hulk Robot

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)




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH -next] gnss: sirf: fix error return code in sirf_probe()
@ 2020-05-07  9:42 ` Wei Yongjun
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Yongjun @ 2020-05-07  9:42 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Wei Yongjun, linux-kernel, kernel-janitors, Hulk Robot

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)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] gnss: sirf: fix error return code in sirf_probe()
  2020-05-07  9:42 ` Wei Yongjun
@ 2020-05-13 14:53   ` Johan Hovold
  -1 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2020-05-13 14:53 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Johan Hovold, linux-kernel, kernel-janitors, Hulk Robot

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] gnss: sirf: fix error return code in sirf_probe()
@ 2020-05-13 14:53   ` Johan Hovold
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2020-05-13 14:53 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Johan Hovold, linux-kernel, kernel-janitors, Hulk Robot

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-13 15:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07  9:42 [PATCH -next] gnss: sirf: fix error return code in sirf_probe() Wei Yongjun
2020-05-07  9:42 ` Wei Yongjun
2020-05-13 14:53 ` Johan Hovold
2020-05-13 14:53   ` Johan Hovold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.