2019-06-25 07:53:24

by Tony Lindgren

[permalink] [raw]
Subject: nl80211 wlcore regression in next

Hi,

Looks like at least drivers/net/wireless/ti wlcore driver has stopped
working in Linux next with commit 901bb9891855 ("nl80211: require and
validate vendor command policy"). Reverting the commit above makes it
work again.

It fails with the warning below, any ideas what goes wrong?

Regards,

Tony

8< ----------------
WARNING: CPU: 0 PID: 21 at net/wireless/core.c:868 wiphy_register+0x85c/0xbd4 [cfg80211]
...
[<bf05f570>] (wiphy_register [cfg80211]) from [<bf121e08>] (ieee80211_register_hw+0x4e4/0xcd8 [mac80211])
[<bf121e08>] (ieee80211_register_hw [mac80211]) from [<bf33135c>] (wlcore_nvs_cb+0x758/0xabc [wlcore])
[<bf33135c>] (wlcore_nvs_cb [wlcore]) from [<c05c3770>] (request_firmware_work_func+0x50/0x8c)
[<c05c3770>] (request_firmware_work_func) from [<c0154bb8>] (process_one_work+0x20c/0x504)
...


2019-06-25 08:01:12

by Tony Lindgren

[permalink] [raw]
Subject: Re: nl80211 wlcore regression in next

Hi,

* Johannes Berg <[email protected]> [190625 07:47]:
> On Tue, 2019-06-25 at 00:38 -0700, Tony Lindgren wrote:
> > Hi,
> >
> > Looks like at least drivers/net/wireless/ti wlcore driver has stopped
> > working in Linux next with commit 901bb9891855 ("nl80211: require and
> > validate vendor command policy"). Reverting the commit above makes it
> > work again.
> >
> > It fails with the warning below, any ideas what goes wrong?
>
> Oops. For some reason, I neglected to check the vendor command usage
> beyond hwsim.
>
> The patch below should work?

Yeah thanks that fixes the issue for me:

Tested-by: Tony Lindgren <[email protected]>

2019-06-25 08:57:35

by Arend Van Spriel

[permalink] [raw]
Subject: Re: nl80211 wlcore regression in next

On 6/25/2019 10:02 AM, Johannes Berg wrote:
> On Tue, 2019-06-25 at 01:00 -0700, Tony Lindgren wrote:
>> Hi,
>>
>> * Johannes Berg <[email protected]> [190625 07:47]:
>>> On Tue, 2019-06-25 at 00:38 -0700, Tony Lindgren wrote:
>>>> Hi,
>>>>
>>>> Looks like at least drivers/net/wireless/ti wlcore driver has stopped
>>>> working in Linux next with commit 901bb9891855 ("nl80211: require and
>>>> validate vendor command policy"). Reverting the commit above makes it
>>>> work again.
>>>>
>>>> It fails with the warning below, any ideas what goes wrong?
>>>
>>> Oops. For some reason, I neglected to check the vendor command usage
>>> beyond hwsim.
>>>
>>> The patch below should work?
>>
>> Yeah thanks that fixes the issue for me:
>>
>> Tested-by: Tony Lindgren <[email protected]>
>
> Thanks, I'll drop that into my tree and hopefully will remember to send
> it on soon.

Hi Johannes,

By chance noticed the patch included brcmfmac. So I tried, but I get
compile issue below. It is because ERR_PTR really is an inline function
so that is not working. So also need to patch that. I left the extra
braces around the error code although not strictly necessary.

Regards,
Arend
---
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 2d17e32..da8249b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4172,7 +4172,7 @@ struct sta_opmode_info {
u8 rx_nss;
};

-#define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)ERR_PTR(-ENODATA))
+#define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(-ENODATA))

/**
* struct wiphy_vendor_command - vendor command definition


---8<--------------------------------------------------------------------
CC [M] drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.o
In file included from
drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c:18:0:
./include/net/cfg80211.h:4175:29: error: initializer element is not constant
#define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)ERR_PTR(-ENODATA))
^
drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c:126:13: note:
in expansion of macro \u2018VENDOR_CMD_RAW_DATA\u2019
.policy = VENDOR_CMD_RAW_DATA,
^
./include/net/cfg80211.h:4175:29: note: (near initialization for
\u2018brcmf_vendor_cmds[0].policy\u2019)
#define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)ERR_PTR(-ENODATA))
^
drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c:126:13: note:
in expansion of macro \u2018VENDOR_CMD_RAW_DATA\u2019
.policy = VENDOR_CMD_RAW_DATA,
^
make[3]: *** [drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.o]
Error 1

2019-06-25 11:45:41

by Kalle Valo

[permalink] [raw]
Subject: Re: nl80211 wlcore regression in next

Tony Lindgren <[email protected]> writes:

> Hi,
>
> * Johannes Berg <[email protected]> [190625 07:47]:
>> On Tue, 2019-06-25 at 00:38 -0700, Tony Lindgren wrote:
>> > Hi,
>> >
>> > Looks like at least drivers/net/wireless/ti wlcore driver has stopped
>> > working in Linux next with commit 901bb9891855 ("nl80211: require and
>> > validate vendor command policy"). Reverting the commit above makes it
>> > work again.
>> >
>> > It fails with the warning below, any ideas what goes wrong?
>>
>> Oops. For some reason, I neglected to check the vendor command usage
>> beyond hwsim.
>>
>> The patch below should work?
>
> Yeah thanks that fixes the issue for me:
>
> Tested-by: Tony Lindgren <[email protected]>

Acked-by: Kalle Valo <[email protected]>

--
Kalle Valo