All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: stating: wilc1000: Add a check for SPI availability
@ 2015-09-14 16:51 Chandra S Gorentla
  2015-09-15  5:13 ` Sudip Mukherjee
  0 siblings, 1 reply; 2+ messages in thread
From: Chandra S Gorentla @ 2015-09-14 16:51 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>
---

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 related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers: stating: wilc1000: Add a check for SPI availability
  2015-09-14 16:51 [PATCH] drivers: stating: wilc1000: Add a check for SPI availability Chandra S Gorentla
@ 2015-09-15  5:13 ` Sudip Mukherjee
  0 siblings, 0 replies; 2+ messages in thread
From: Sudip Mukherjee @ 2015-09-15  5:13 UTC (permalink / raw)
  To: Chandra S Gorentla
  Cc: gregkh, rachel.kim, dean.lee, chris.park, devel, linux-wireless,
	johnny.kim, linux-kernel

On Mon, Sep 14, 2015 at 10:21:14PM +0530, Chandra S Gorentla wrote:
> 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>
> ---
A small spelling mistake in the subject. It should be "staging" and not
"stating"

regards
sudip

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

end of thread, other threads:[~2015-09-15  5:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-14 16:51 [PATCH] drivers: stating: wilc1000: Add a check for SPI availability Chandra S Gorentla
2015-09-15  5:13 ` Sudip Mukherjee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.