mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] drivers: staging: wilc1000: Add check for SPI availability
@ 2015-09-15 12:39 Chandra S Gorentla
  0 siblings, 0 replies; only message in thread
From: Chandra S Gorentla @ 2015-09-15 12:39 UTC (permalink / raw)
  To: gregkh
  Cc: johnny.kim, rachel.kim, dean.lee, chris.park, linux-wireless,
	devel, linux-kernel, Chandra S Gorentla

NULL pointer deference is observed in the wilc1000.ko module
with bus type SPI and when SPI is not ready.

Signed-off-by: Chandra S Gorentla <csgorentla@gmail.com>
---

v2 - Subject corrected 'stating:' -> 'staging:'

Following are the steps to reproduce.

$ sudo insmod drivers/staging/wilc1000/wilc1000.ko
$ sudo ifconfig wlan1 up

wlan1 in the above command is the device controlled by 'wilc1000.ko'.

 drivers/staging/wilc1000/linux_wlan.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 63f44f8..48f063d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1634,6 +1634,12 @@ int mac_open(struct net_device *ndev)
 	int i = 0;
 	struct WILC_WFI_priv *priv;
 
+#ifdef WILC_SPI
+	if (!g_linux_wlan || !g_linux_wlan->wilc_spidev) {
+		netdev_err(ndev, "wilc1000: SPI device not ready\n");
+		return -ENODEV;
+	}
+#endif
 	nic = netdev_priv(ndev);
 	priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
 	PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);
-- 
2.5.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-09-15 12:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-15 12:39 [PATCH v2] drivers: staging: wilc1000: Add check for SPI availability Chandra S Gorentla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®