netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: rsi: Do not configure WoWlan in shutdown hook if not enabled
@ 2023-05-27 22:28 Marek Vasut
  2023-05-30  7:36 ` Simon Horman
  2023-06-08 16:01 ` Kalle Valo
  0 siblings, 2 replies; 4+ messages in thread
From: Marek Vasut @ 2023-05-27 22:28 UTC (permalink / raw)
  To: linux-wireless
  Cc: Marek Vasut, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Jilin Yuan, Kalle Valo, Paolo Abeni, netdev

In case WoWlan was never configured during the operation of the system,
the hw->wiphy->wowlan_config will be NULL. rsi_config_wowlan() checks
whether wowlan_config is non-NULL and if it is not, then WARNs about it.
The warning is valid, as during normal operation the rsi_config_wowlan()
should only ever be called with non-NULL wowlan_config. In shutdown this
rsi_config_wowlan() should only ever be called if WoWlan was configured
before by the user.

Add checks for non-NULL wowlan_config into the shutdown hook. While at it,
check whether the wiphy is also non-NULL before accessing wowlan_config .
Drop the single-use wowlan_config variable, just inline it into function
call.

Fixes: 16bbc3eb8372 ("rsi: fix null pointer dereference during rsi_shutdown()")
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jilin Yuan <yuanjilin@cdjrlc.com>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: Marek Vasut <marex@denx.de>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
---
 drivers/net/wireless/rsi/rsi_91x_sdio.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
index d09998796ac08..6e33a2563fdbd 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
@@ -1463,10 +1463,8 @@ static void rsi_shutdown(struct device *dev)
 
 	rsi_dbg(ERR_ZONE, "SDIO Bus shutdown =====>\n");
 
-	if (hw) {
-		struct cfg80211_wowlan *wowlan = hw->wiphy->wowlan_config;
-
-		if (rsi_config_wowlan(adapter, wowlan))
+	if (hw && hw->wiphy && hw->wiphy->wowlan_config) {
+		if (rsi_config_wowlan(adapter, hw->wiphy->wowlan_config))
 			rsi_dbg(ERR_ZONE, "Failed to configure WoWLAN\n");
 	}
 
-- 
2.39.2


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

* Re: [PATCH] wifi: rsi: Do not configure WoWlan in shutdown hook if not enabled
  2023-05-27 22:28 [PATCH] wifi: rsi: Do not configure WoWlan in shutdown hook if not enabled Marek Vasut
@ 2023-05-30  7:36 ` Simon Horman
  2023-05-30  7:37   ` Simon Horman
  2023-06-08 16:01 ` Kalle Valo
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Horman @ 2023-05-30  7:36 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-wireless, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Jilin Yuan, Kalle Valo, Paolo Abeni, netdev

On Sun, May 28, 2023 at 12:28:33AM +0200, Marek Vasut wrote:
> In case WoWlan was never configured during the operation of the system,
> the hw->wiphy->wowlan_config will be NULL. rsi_config_wowlan() checks
> whether wowlan_config is non-NULL and if it is not, then WARNs about it.
> The warning is valid, as during normal operation the rsi_config_wowlan()
> should only ever be called with non-NULL wowlan_config. In shutdown this
> rsi_config_wowlan() should only ever be called if WoWlan was configured
> before by the user.
> 
> Add checks for non-NULL wowlan_config into the shutdown hook. While at it,
> check whether the wiphy is also non-NULL before accessing wowlan_config .
> Drop the single-use wowlan_config variable, just inline it into function
> call.
> 
> Fixes: 16bbc3eb8372 ("rsi: fix null pointer dereference during rsi_shutdown()")

nit: no blank line here

> Signed-off-by: Marek Vasut <marex@denx.de>

Reviewed-by: Simon Horman <simon.horman@corigine.com>

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

* Re: [PATCH] wifi: rsi: Do not configure WoWlan in shutdown hook if not enabled
  2023-05-30  7:36 ` Simon Horman
@ 2023-05-30  7:37   ` Simon Horman
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2023-05-30  7:37 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-wireless, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Jilin Yuan, Kalle Valo, Paolo Abeni, netdev

On Tue, May 30, 2023 at 09:36:36AM +0200, Simon Horman wrote:
> On Sun, May 28, 2023 at 12:28:33AM +0200, Marek Vasut wrote:
> > In case WoWlan was never configured during the operation of the system,
> > the hw->wiphy->wowlan_config will be NULL. rsi_config_wowlan() checks
> > whether wowlan_config is non-NULL and if it is not, then WARNs about it.
> > The warning is valid, as during normal operation the rsi_config_wowlan()
> > should only ever be called with non-NULL wowlan_config. In shutdown this
> > rsi_config_wowlan() should only ever be called if WoWlan was configured
> > before by the user.
> > 
> > Add checks for non-NULL wowlan_config into the shutdown hook. While at it,
> > check whether the wiphy is also non-NULL before accessing wowlan_config .
> > Drop the single-use wowlan_config variable, just inline it into function
> > call.
> > 
> > Fixes: 16bbc3eb8372 ("rsi: fix null pointer dereference during rsi_shutdown()")
> 
> nit: no blank line here

Sigh, there was no blank line here.
Sorry for the noise.

> > Signed-off-by: Marek Vasut <marex@denx.de>
> 
> Reviewed-by: Simon Horman <simon.horman@corigine.com>

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

* Re: [PATCH] wifi: rsi: Do not configure WoWlan in shutdown hook if not enabled
  2023-05-27 22:28 [PATCH] wifi: rsi: Do not configure WoWlan in shutdown hook if not enabled Marek Vasut
  2023-05-30  7:36 ` Simon Horman
@ 2023-06-08 16:01 ` Kalle Valo
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2023-06-08 16:01 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-wireless, Marek Vasut, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jilin Yuan, Paolo Abeni, netdev

Marek Vasut <marex@denx.de> wrote:

> In case WoWlan was never configured during the operation of the system,
> the hw->wiphy->wowlan_config will be NULL. rsi_config_wowlan() checks
> whether wowlan_config is non-NULL and if it is not, then WARNs about it.
> The warning is valid, as during normal operation the rsi_config_wowlan()
> should only ever be called with non-NULL wowlan_config. In shutdown this
> rsi_config_wowlan() should only ever be called if WoWlan was configured
> before by the user.
> 
> Add checks for non-NULL wowlan_config into the shutdown hook. While at it,
> check whether the wiphy is also non-NULL before accessing wowlan_config .
> Drop the single-use wowlan_config variable, just inline it into function
> call.
> 
> Fixes: 16bbc3eb8372 ("rsi: fix null pointer dereference during rsi_shutdown()")
> Signed-off-by: Marek Vasut <marex@denx.de>
> Reviewed-by: Simon Horman <simon.horman@corigine.com>

Patch applied to wireless-next.git, thanks.

b241e260820b wifi: rsi: Do not configure WoWlan in shutdown hook if not enabled

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20230527222833.273741-1-marex@denx.de/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2023-06-08 16:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-27 22:28 [PATCH] wifi: rsi: Do not configure WoWlan in shutdown hook if not enabled Marek Vasut
2023-05-30  7:36 ` Simon Horman
2023-05-30  7:37   ` Simon Horman
2023-06-08 16:01 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).