From: Colin Ian King Date: Sat, 13 Aug 2016 18:52:38 +0000 (+0100) Subject: staging: ks7010: do not dereference priv if priv is null X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=803394d03b43ba0ef4a9ed148de19c01d87cd13a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: ks7010: do not dereference priv if priv is null priv is being dereferenced before a check for it being null is made, so there is a possibililty a null pointer deference can occur. Instead, only dereference priv if it is non-null. Signed-off-by: Colin Ian King Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index a0facfc54e4b..47b69cbdb45b 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -1134,7 +1134,6 @@ static void ks7010_sdio_remove(struct sdio_func *func) int ret; struct ks_sdio_card *card; struct ks_wlan_private *priv; - struct net_device *netdev; DPRINTK(1, "ks7010_sdio_remove()\n"); card = sdio_get_drvdata(func); @@ -1144,8 +1143,9 @@ static void ks7010_sdio_remove(struct sdio_func *func) DPRINTK(1, "priv = card->priv\n"); priv = card->priv; - netdev = priv->net_dev; if (priv) { + struct net_device *netdev = priv->net_dev; + ks_wlan_net_stop(netdev); DPRINTK(1, "ks_wlan_net_stop\n");