Re: nl80211 wlcore regression in next

From: Arend Van Spriel
Date: Tue Jun 25 2019 - 04:56:46 EST


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 <johannes@xxxxxxxxxxxxxxxx> [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 <tony@xxxxxxxxxxx>

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