linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] staging: ks7010: fix null pointer dereference on priv on error exit
@ 2018-04-12 14:57 Colin King
  2018-04-12 15:12 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2018-04-12 14:57 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Tobin C . Harding, Sergio Paracuellos,
	Quytelda Kahja, devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

In the case where the call to dev_alloc_name fails the current exit
path is via err_free_netdev and this calls free_netdev on a null priv
pointer, hence causing a null pointer dereference.  Fix this by instead
exiting via err_release_irq.

Detected by CoverityScan, CID#1467844 ("Explitic null dereferenced")

Fixes: 13a9930d15b4 ("staging: ks7010: add driver from Nanonote extra-repository")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/staging/ks7010/ks7010_sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index b8f55a11ee1c..cb0e11d79e32 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -895,7 +895,7 @@ static int ks7010_sdio_probe(struct sdio_func *func,
 		netdev_err(priv->net_dev,
 			   "ks7010: firmware load failed !! return code = %d\n",
 			   ret);
-		goto err_free_netdev;
+		goto err_release_irq;
 	}
 
 	/* interrupt setting */
-- 
2.17.0

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

* Re: [PATCH][next] staging: ks7010: fix null pointer dereference on priv on error exit
  2018-04-12 14:57 [PATCH][next] staging: ks7010: fix null pointer dereference on priv on error exit Colin King
@ 2018-04-12 15:12 ` Dan Carpenter
  2018-04-12 15:20   ` Colin Ian King
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2018-04-12 15:12 UTC (permalink / raw)
  To: Colin King
  Cc: devel, Greg Kroah-Hartman, kernel-janitors, linux-kernel,
	Sergio Paracuellos, Quytelda Kahja

This isn't right.  It introduces a leak.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH][next] staging: ks7010: fix null pointer dereference on priv on error exit
  2018-04-12 15:12 ` Dan Carpenter
@ 2018-04-12 15:20   ` Colin Ian King
  0 siblings, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2018-04-12 15:20 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, Greg Kroah-Hartman, kernel-janitors, linux-kernel,
	Sergio Paracuellos, Quytelda Kahja

On 12/04/18 16:12, Dan Carpenter wrote:
> This isn't right.  It introduces a leak.

Yup, and I see Gustavo is working on a correct fix, I'll leave that to him.
> 
> regards,
> dan carpenter
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2018-04-12 15:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-12 14:57 [PATCH][next] staging: ks7010: fix null pointer dereference on priv on error exit Colin King
2018-04-12 15:12 ` Dan Carpenter
2018-04-12 15:20   ` Colin Ian King

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).