Skip to contentSkip to conversation

staging: ks7010: fix null pointer dereference on priv on error exit

PATCH In review Colin King 2 participants 3 messages Apr 12, 2018

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 staging: ks7010: fix null pointer dereference on priv on error exit

From: Colin Ian King <[email protected]>

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")
---
 drivers/staging/ks7010/ks7010_sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/ks7010/ks7010_sdio.c +1 -1
index b8f55a11ee1c..cb0e11d79e32 100644
@@ -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 */
Signature · 1 line
2.17.0
#1 lore raw

This isn't right. It introduces a leak.

regards,
dan carpenter

#2 lore raw
Quoted 1 line · Dan Carpenter

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.

Quoted 9 lines

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html