[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1471114358-20257-1-git-send-email-colin.king@canonical.com>
Date: Sat, 13 Aug 2016 19:52:38 +0100
From: Colin King <colin.king@...onical.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Wolfram Sang <wsa@...-dreams.de>, devel@...verdev.osuosl.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] staging: ks7010: do not dereference priv if priv is null
From: Colin Ian King <colin.king@...onical.com>
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 <colin.king@...onical.com>
---
drivers/staging/ks7010/ks7010_sdio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index b7337fd..11fed58 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -1141,7 +1141,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);
@@ -1151,8 +1150,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");
--
2.8.1
Powered by blists - more mailing lists