From 1ff007ee9385b1673948579eb4e6b912abee8df0 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Wed, 7 Sep 2011 16:17:10 -0700 Subject: [PATCH] net: wireless: bcmdhd: Prohibit FW access in case of FW crash Signed-off-by: Dmitry Shmidt --- drivers/net/wireless/bcmdhd/dhd_cdc.c | 2 +- drivers/net/wireless/bcmdhd/dhd_linux.c | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/bcmdhd/dhd_cdc.c b/drivers/net/wireless/bcmdhd/dhd_cdc.c index a86ea56bf04e..67d9481a21be 100644 --- a/drivers/net/wireless/bcmdhd/dhd_cdc.c +++ b/drivers/net/wireless/bcmdhd/dhd_cdc.c @@ -282,7 +282,7 @@ dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len) int ret = -1; uint8 action; - if (dhd->busstate == DHD_BUS_DOWN) { + if ((dhd->busstate == DHD_BUS_DOWN) || dhd->hang_was_sent) { DHD_ERROR(("%s : bus is down. we have nothing to do\n", __FUNCTION__)); goto done; } diff --git a/drivers/net/wireless/bcmdhd/dhd_linux.c b/drivers/net/wireless/bcmdhd/dhd_linux.c index 61b1aef1b011..6f19cb726490 100644 --- a/drivers/net/wireless/bcmdhd/dhd_linux.c +++ b/drivers/net/wireless/bcmdhd/dhd_linux.c @@ -2000,6 +2000,14 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) DHD_OS_WAKE_LOCK(&dhd->pub); + /* send to dongle only if we are not waiting for reload already */ + if (dhd->pub.hang_was_sent) { + DHD_ERROR(("%s: HANG was sent up earlier\n", __FUNCTION__)); + DHD_OS_WAKE_LOCK_TIMEOUT_ENABLE(&dhd->pub, DHD_EVENT_TIMEOUT); + DHD_OS_WAKE_UNLOCK(&dhd->pub); + return OSL_ERROR(BCME_DONGLE_DOWN); + } + ifidx = dhd_net2idx(dhd, net); DHD_TRACE(("%s: ifidx %d, cmd 0x%04x\n", __FUNCTION__, ifidx, cmd)); @@ -2078,14 +2086,6 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) goto done; } - /* send to dongle only if we are not waiting for reload already */ - if (dhd->pub.hang_was_sent) { - DHD_ERROR(("%s: HANG was sent up earlier. Not talking to the chip\n", - __FUNCTION__)); - bcmerror = BCME_DONGLE_DOWN; - goto done; - } - /* check for local dhd ioctl and handle it */ if (driver == DHD_IOCTL_MAGIC) { bcmerror = dhd_ioctl((void *)&dhd->pub, &ioc, buf, buflen); @@ -2267,7 +2267,7 @@ dhd_stop(struct net_device *net) if (ifidx == 0) wl_android_wifi_off(net); #endif - + dhd->pub.hang_was_sent = 0; OLD_MOD_DEC_USE_COUNT; return 0; } @@ -2317,7 +2317,6 @@ dhd_open(struct net_device *net) #if defined(WL_CFG80211) DHD_ERROR(("\n%s\n", dhd_version)); wl_android_wifi_on(net); - dhd->pub.hang_was_sent = 0; #endif if (dhd->pub.busstate != DHD_BUS_DATA) { -- 2.34.1