Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] brcmfmac: fix brcmf_wiphy_wowl_params() NULL pointer dereference
@ 2018-08-07  6:18 Chi-Hsien Lin
  2018-08-07 11:28 ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Chi-Hsien Lin @ 2018-08-07  6:18 UTC (permalink / raw)
  To: linux-wireless
  Cc: brcm80211-dev-list.pdl, brcm80211-dev-list, Arend van Spriel,
	Franky Lin, Hante Meuleman, Wright Feng, Kalle Valo, Winnie Chang

From: Winnie Chang <winnie.chang@cypress.com>

The kernel BUG happens when wowl is enabled from firmware. In
brcmf_wiphy_wowl_params(), cfg is a NULL pointer because it is
drvr->config returned from wiphy_to_cfg(), and drvr->config is not set
yet. To fix it, set drvr->config before brcmf_setup_wiphy() which
calls brcmf_wiphy_wowl_params().

The kernel panic is introduced in below commit:
commit id: 856d5a011c86b59f6564be4508912fb1d866adfc
brcmfmac: allocate struct brcmf_pub instance using wiphy_new()

Signed-off-by: Winnie Chang <winnie.chang@cypress.com>
Reviewed-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 24c4e18..5444e62 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -6926,15 +6926,15 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
 	cfg->d11inf.io_type = (u8)io_type;
 	brcmu_d11_attach(&cfg->d11inf);
 
-	err = brcmf_setup_wiphy(wiphy, ifp);
-	if (err < 0)
-		goto priv_out;
-
 	/* regulatory notifer below needs access to cfg so
 	 * assign it now.
 	 */
 	drvr->config = cfg;
 
+	err = brcmf_setup_wiphy(wiphy, ifp);
+	if (err < 0)
+		goto priv_out;
+
 	brcmf_dbg(INFO, "Registering custom regulatory\n");
 	wiphy->reg_notifier = brcmf_cfg80211_reg_notifier;
 	wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
-- 
2.1.0

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

* Re: [PATCH] brcmfmac: fix brcmf_wiphy_wowl_params() NULL pointer dereference
  2018-08-07  6:18 [PATCH] brcmfmac: fix brcmf_wiphy_wowl_params() NULL pointer dereference Chi-Hsien Lin
@ 2018-08-07 11:28 ` Kalle Valo
  2018-08-07 13:40   ` Chi-Hsien Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2018-08-07 11:28 UTC (permalink / raw)
  To: Chi-Hsien Lin
  Cc: linux-wireless, brcm80211-dev-list.pdl, brcm80211-dev-list,
	Arend van Spriel, Franky Lin, Hante Meuleman, Wright Feng,
	Winnie Chang

Chi-Hsien Lin <chi-hsien.lin@cypress.com> writes:

> From: Winnie Chang <winnie.chang@cypress.com>
>
> The kernel BUG happens when wowl is enabled from firmware. In
> brcmf_wiphy_wowl_params(), cfg is a NULL pointer because it is
> drvr->config returned from wiphy_to_cfg(), and drvr->config is not set
> yet. To fix it, set drvr->config before brcmf_setup_wiphy() which
> calls brcmf_wiphy_wowl_params().
>
> The kernel panic is introduced in below commit:
> commit id: 856d5a011c86b59f6564be4508912fb1d866adfc
> brcmfmac: allocate struct brcmf_pub instance using wiphy_new()
>
> Signed-off-by: Winnie Chang <winnie.chang@cypress.com>
> Reviewed-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>

Chi-Hsien, you need to include your own s-o-b as well when you are
submitting the patch:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#signed-off-by_missing

-- 
Kalle Valo

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

* Re: [PATCH] brcmfmac: fix brcmf_wiphy_wowl_params() NULL pointer dereference
  2018-08-07 11:28 ` Kalle Valo
@ 2018-08-07 13:40   ` Chi-Hsien Lin
  0 siblings, 0 replies; 3+ messages in thread
From: Chi-Hsien Lin @ 2018-08-07 13:40 UTC (permalink / raw)
  To: Kalle Valo
  Cc: linux-wireless, brcm80211-dev-list.pdl, brcm80211-dev-list,
	Arend van Spriel, Franky Lin, Hante Meuleman, Wright Feng,
	Winnie Chang



On 08/07/2018 7:28, Kalle Valo wrote:
> Chi-Hsien Lin <chi-hsien.lin@cypress.com> writes:
> 
>> From: Winnie Chang <winnie.chang@cypress.com>
>>
>> The kernel BUG happens when wowl is enabled from firmware. In
>> brcmf_wiphy_wowl_params(), cfg is a NULL pointer because it is
>> drvr->config returned from wiphy_to_cfg(), and drvr->config is not set
>> yet. To fix it, set drvr->config before brcmf_setup_wiphy() which
>> calls brcmf_wiphy_wowl_params().
>>
>> The kernel panic is introduced in below commit:
>> commit id: 856d5a011c86b59f6564be4508912fb1d866adfc
>> brcmfmac: allocate struct brcmf_pub instance using wiphy_new()
>>
>> Signed-off-by: Winnie Chang <winnie.chang@cypress.com>
>> Reviewed-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
> 
> Chi-Hsien, you need to include your own s-o-b as well when you are
> submitting the patch:
> 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#signed-off-by_missing

Hi Kalle,

Thanks a lot for the notes. I've added proper s-o-b in V2.

Chi-hsien Lin

> 
> --
> Kalle Valo
> 
> 
> ----------
> 
> You're receiving this message because you're a member of the brcm80211-dev-list group.
> .
> 

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

end of thread, other threads:[~2018-08-07 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-07  6:18 [PATCH] brcmfmac: fix brcmf_wiphy_wowl_params() NULL pointer dereference Chi-Hsien Lin
2018-08-07 11:28 ` Kalle Valo
2018-08-07 13:40   ` Chi-Hsien Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox