Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1224345 > unrolled thread

[PATCH] drivers: stating: wilc1000: Add a check for SPI availability

Started byChandra S Gorentla <csgorentla@gmail.com>
First post2015-09-14 19:00 +0200
Last post2015-09-15 07:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drivers: stating: wilc1000: Add a check for SPI availability Chandra S Gorentla <csgorentla@gmail.com> - 2015-09-14 19:00 +0200
    Re: [PATCH] drivers: stating: wilc1000: Add a check for SPI  availability Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-15 07:20 +0200

#1224345 — [PATCH] drivers: stating: wilc1000: Add a check for SPI availability

FromChandra S Gorentla <csgorentla@gmail.com>
Date2015-09-14 19:00 +0200
Subject[PATCH] drivers: stating: wilc1000: Add a check for SPI availability
Message-ID<q8FgL-3Ce-23@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1224643 — Re: [PATCH] drivers: stating: wilc1000: Add a check for SPI availability

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-09-15 07:20 +0200
SubjectRe: [PATCH] drivers: stating: wilc1000: Add a check for SPI availability
Message-ID<q8QOR-3yT-5@gated-at.bofh.it>
In reply to#1224345
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web