diff mbox

[1/3] rsi: Add null check for virtual interfaces in wowlan config

Message ID 1526050673-7026-2-git-send-email-sushant2k1513@gmail.com (mailing list archive)
State Accepted
Commit 54b5172087aeae61150835c91e68f084a9644f1c
Delegated to: Kalle Valo
Headers show

Commit Message

Sushant Kumar Mishra May 11, 2018, 2:57 p.m. UTC
From: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>

When the "poweroff" command is executed after wowlan enabled, we have
observed a system crash. In the system "poweroff" sequence, network-manager
is sent to inactive state by cleaning up the network interfaces, using
rsi_mac80211_remove_interface() and when driver tries to access those
network interfaces in rsi_wowlan_config() which was invoked by SDIO
shutdown, results in a crash. Added a NULL check before accessing the
network interfaces in rsi_wowlan_config().

Signed-off-by: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>
---
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Kalle Valo May 15, 2018, 5:39 a.m. UTC | #1
Sushant Kumar Mishra <sushant2k1513@gmail.com> wrote:

> From: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
> 
> When the "poweroff" command is executed after wowlan enabled, we have
> observed a system crash. In the system "poweroff" sequence, network-manager
> is sent to inactive state by cleaning up the network interfaces, using
> rsi_mac80211_remove_interface() and when driver tries to access those
> network interfaces in rsi_wowlan_config() which was invoked by SDIO
> shutdown, results in a crash. Added a NULL check before accessing the
> network interfaces in rsi_wowlan_config().
> 
> Signed-off-by: Sanjay Kumar Konduri <sanjay.konduri@redpinesignals.com>
> Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> Signed-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>

3 patches applied to wireless-drivers-next.git, thanks.

54b5172087ae rsi: Add null check for virtual interfaces in wowlan config
d76f8513fa90 rsi: reset hibernate_resume flag to work hibernate resume in coex mode.
1d18c5584c05 rsi: Set wowlan flag while writing wowlan config parameters
diff mbox

Patch

diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index 80e7f4f..743706e 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -1804,10 +1804,15 @@  int rsi_config_wowlan(struct rsi_hw *adapter, struct cfg80211_wowlan *wowlan)
 	struct rsi_common *common = adapter->priv;
 	u16 triggers = 0;
 	u16 rx_filter_word = 0;
-	struct ieee80211_bss_conf *bss = &adapter->vifs[0]->bss_conf;
+	struct ieee80211_bss_conf *bss = NULL;
 
 	rsi_dbg(INFO_ZONE, "Config WoWLAN to device\n");
 
+	if (!adapter->vifs[0])
+		return -EINVAL;
+
+	bss = &adapter->vifs[0]->bss_conf;
+
 	if (WARN_ON(!wowlan)) {
 		rsi_dbg(ERR_ZONE, "WoW triggers not enabled\n");
 		return -EINVAL;