Re: [PATCH net-next v6 02/15] netlink: rename nl80211_validate_nested() to nla_validate_nested()

2019-07-02 Thread Johannes Berg
a_validate_nested(). Umm, right, not sure how that happened. Sorry about that. Reviewed-by: Johannes Berg

Re: [PATCH net-next v6] net: sched: Introduce act_ctinfo action

2019-06-12 Thread Johannes Berg
(switching to my personal email) > > I can't add these actions with current net-next and iproute-next: > > # ~/iproute2/tc/tc action add action ctinfo dscp 0xfc00 0x0100 > > Error: NLA_F_NESTED is missing. > > We have an error talking to the kernel > > > > This also happens with the curre

Re: [PATCH] NFC: Orphan the subsystem

2019-05-14 Thread Johannes Berg
On Tue, 2019-05-14 at 13:02 +0300, Andy Shevchenko wrote: > On Tue, May 14, 2019 at 11:02:31AM +0200, Johannes Berg wrote: > > Samuel clearly hasn't been working on this in many years and > > patches getting to the wireless list are just being ignored > > entirely now. Ma

[PATCH] NFC: Orphan the subsystem

2019-05-14 Thread Johannes Berg
ff-by: Johannes Berg --- MAINTAINERS | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index fb9f9d71f7a2..b2659312e9ed 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11028,10 +11028,8 @@ S: Supported F: drivers/net/ethernet/qlogic/netxen/

[PATCH net] um: vector netdev: adjust to xmit_more API change

2019-05-03 Thread Johannes Berg
From: Johannes Berg Replace skb->xmit_more usage by netdev_xmit_more(). Fixes: 4f296edeb9d4 ("drivers: net: aurora: use netdev_xmit_more helper") Signed-off-by: Johannes Berg --- arch/um/drivers/vector_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ar

[PATCH v2 2/8] netlink: remove type-unsafe validation_data pointer

2019-05-03 Thread Johannes Berg
From: Johannes Berg In the netlink policy, we currently have a void *validation_data that's pointing to different things: * a u32 value for bitfield32, * the netlink policy for nested/nested array * the string for NLA_REJECT Remove the pointer and place appropriate type-safe items i

[PATCH v2 5/8] netlink: remove NLA_EXACT_LEN_WARN

2019-05-03 Thread Johannes Berg
From: Johannes Berg Use a validation type instead, so we can later expose the NLA_* values to userspace for policy descriptions. Signed-off-by: Johannes Berg --- include/net/netlink.h | 15 --- lib/nlattr.c | 16 ++-- 2 files changed, 18 insertions(+), 13

[PATCH v2 0/8] netlink policy export and recursive validation

2019-05-03 Thread Johannes Berg
Here's (finally, sorry) the respin with the range/range_signed assignment fixed up. I've now included the validation recursion protection so it's clear that it applies on top of the other patches only. johannes

[PATCH v2 6/8] netlink: factor out policy range helpers

2019-05-03 Thread Johannes Berg
From: Johannes Berg Add helpers to get the policy's signed/unsigned range validation data. Signed-off-by: Johannes Berg --- include/net/netlink.h | 5 +++ lib/nlattr.c | 95 +-- 2 files changed, 79 insertions(+), 21 deletions(-) diff --

[PATCH v2 4/8] netlink: allow NLA_MSECS to have range validation

2019-05-03 Thread Johannes Berg
From: Johannes Berg Since NLA_MSECS is really equivalent to NLA_U64, allow it to have range validation as well. Signed-off-by: Johannes Berg --- include/net/netlink.h | 6 -- lib/nlattr.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/net/netlink.h

[PATCH v2 1/8] nl80211: fix NL80211_ATTR_FTM_RESPONDER policy

2019-05-03 Thread Johannes Berg
From: Johannes Berg The nested policy here should be established using the NLA_POLICY_NESTED() macro so the length is properly filled in. Fixes: 81e54d08d9d8 ("cfg80211: support FTM responder configuration/statistics") Signed-off-by: Johannes Berg --- net/wireless/nl80211.c | 6 ++--

[PATCH v2 3/8] netlink: extend policy range validation

2019-05-03 Thread Johannes Berg
From: Johannes Berg Using a pointer to a struct indicating the min/max values, extend the ability to do range validation for arbitrary values. Small values in the s16 range can be kept in the policy directly. Signed-off-by: Johannes Berg --- include/net/netlink.h | 45 + lib

[PATCH v2 7/8] netlink: add infrastructure to expose policies to userspace

2019-05-03 Thread Johannes Berg
From: Johannes Berg Add, and use in generic netlink, helpers to dump out a netlink policy to userspace, including all the range validation data, nested policies etc. This lets userspace discover what the kernel understands. For families/commands other than generic netlink, the helpers need to

[PATCH v2 8/8] netlink: limit recursion depth in policy validation

2019-05-03 Thread Johannes Berg
From: Johannes Berg Now that we have nested policies, we can theoretically recurse forever parsing attributes if a (sub-)policy refers back to a higher level one. This is a situation that has happened in nl80211, and we've avoided it there by not linking it. Add some code to netlink parsi

Re: [PATCH] netlink: limit recursion depth in policy validation

2019-04-29 Thread Johannes Berg
On Mon, 2019-04-29 at 23:08 -0400, David Miller wrote: > From: Johannes Berg > Date: Fri, 26 Apr 2019 14:13:46 +0200 > > > From: Johannes Berg > > > > Now that we have nested policies, we can theoretically > > recurse forever parsing attributes if a (sub-)p

Re: [PATCH 2/6] netlink: extend policy range validation

2019-04-29 Thread Johannes Berg
On Mon, 2019-04-29 at 22:49 -0400, David Miller wrote: > From: Johannes Berg > Date: Fri, 26 Apr 2019 14:13:02 +0200 > > > * NLA_POLICY_RANGE() macros. > > + *NLA_U8, > > + *NLA_U16, > > + *NLA_U32, > > + *NLA_

Re: [PATCH 6/6] netlink: add infrastructure to expose policies to userspace

2019-04-28 Thread Johannes Berg
On Sat, 2019-04-27 at 13:25 +0200, Pablo Neira Ayuso wrote: > > > Take IFLA_AF_SPEC for example. To validate that, we end up calling into > > validate_link_af() which is defined in IPv4 and IPv6, rather than having > > the inet_af_policy/inet6_af_policy available and doing it in the caller > > (al

Re: [PATCH] netlink: limit recursion depth in policy validation

2019-04-28 Thread Johannes Berg
Hi Pablo, > > + [NL80211_PMSR_PEER_ATTR_CHAN] = NLA_POLICY_NESTED(nl80211_policy), > > I guess you only allow one more nested instance of this attribute? > > I mean, how many times is NL80211 allow to recurse on this? It doesn't actually recurse on this at all. We really should've specified

Re: [PATCH v2 0/5] strict netlink validation

2019-04-28 Thread Johannes Berg
On Fri, 2019-04-26 at 20:28 -0600, David Ahern wrote: > > I agree with this set and will help moving forward. As I recall it > requires follow up patches for each policy to set strict_start_type > opting in to the strict checking. With that in place new userspace on > old kernels will get a failur

Re: [PATCH 6/6] netlink: add infrastructure to expose policies to userspace

2019-04-26 Thread Johannes Berg
On Fri, 2019-04-26 at 20:21 +0200, Pablo Neira Ayuso wrote: > On Fri, Apr 26, 2019 at 02:13:06PM +0200, Johannes Berg wrote: > > diff --git a/include/uapi/linux/genetlink.h b/include/uapi/linux/genetlink.h > > index 877f7fa95466..9c0636ec2286 100644 > > --- a/include/u

Re: [RFC] netlink: limit recursion depth in policy validation

2019-04-26 Thread Johannes Berg
On Fri, 2019-04-26 at 19:06 +0200, Pablo Neira Ayuso wrote: > > > This basically flattens the whole thing. > > > > Obviously, the walking may allocate some memory, and the last loop to > > send it out isn't actually a loop like that because it's a netlink dump > > with each entry being in a separ

Re: [RFC] netlink: limit recursion depth in policy validation

2019-04-26 Thread Johannes Berg
On Fri, 2019-04-26 at 18:57 +0200, Pablo Neira Ayuso wrote: > > > +/* > > + * Nested policies might refer back to the original > > + * policy in some cases, and userspace could try to > > + * abuse that and recurse by nesting in the right > > + * ways. Limit recursion to avoid this problem. > > +

[PATCH] netlink: limit recursion depth in policy validation

2019-04-26 Thread Johannes Berg
From: Johannes Berg Now that we have nested policies, we can theoretically recurse forever parsing attributes if a (sub-)policy refers back to a higher level one. This is a situation that has happened in nl80211, and we've avoided it there by not linking it. Add some code to netlink parsi

[PATCH 5/6] netlink: factor out policy range helpers

2019-04-26 Thread Johannes Berg
From: Johannes Berg Add helpers to get the policy's signed/unsigned range validation data. Signed-off-by: Johannes Berg --- include/net/netlink.h | 5 +++ lib/nlattr.c | 95 +-- 2 files changed, 79 insertions(+), 21 deletions(-) diff --

[PATCH 4/6] netlink: remove NLA_EXACT_LEN_WARN

2019-04-26 Thread Johannes Berg
From: Johannes Berg Use a validation type instead, so we can later expose the NLA_* values to userspace for policy descriptions. Signed-off-by: Johannes Berg --- include/net/netlink.h | 15 --- lib/nlattr.c | 16 ++-- 2 files changed, 18 insertions(+), 13

[PATCH 3/6] netlink: allow NLA_MSECS to have range validation

2019-04-26 Thread Johannes Berg
From: Johannes Berg Since NLA_MSECS is really equivalent to NLA_U64, allow it to have range validation as well. Signed-off-by: Johannes Berg --- include/net/netlink.h | 6 -- lib/nlattr.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/net/netlink.h

[PATCH 1/6] netlink: remove type-unsafe validation_data pointer

2019-04-26 Thread Johannes Berg
From: Johannes Berg In the netlink policy, we currently have a void *validation_data that's pointing to different things: * a u32 value for bitfield32, * the netlink policy for nested/nested array * the string for NLA_REJECT Remove the pointer and place appropriate type-safe items i

[PATCH 2/6] netlink: extend policy range validation

2019-04-26 Thread Johannes Berg
From: Johannes Berg Using a pointer to a struct indicating the min/max values, extend the ability to do range validation for arbitrary values. Small values in the s16 range can be kept in the policy directly. Signed-off-by: Johannes Berg --- include/net/netlink.h | 45 + lib

[PATCH 6/6] netlink: add infrastructure to expose policies to userspace

2019-04-26 Thread Johannes Berg
From: Johannes Berg Add, and use in generic netlink, helpers to dump out a netlink policy to userspace, including all the range validation data, nested policies etc. This lets userspace discover what the kernel understands. For families/commands other than generic netlink, the helpers need to

[PATCH 0/6] netlink: expose policies to userspace

2019-04-26 Thread Johannes Berg
Make some cleanups in policy validation, and add tools to expose the policies to userspace. This lets userspace discover what the appropriate data for an element is. Note that NLA_UNSPEC items are omitted as they're rejected in strict validation mode so their policy entries should be changed to N

[PATCH v2 5/5] genetlink: optionally validate strictly/dumps

2019-04-26 Thread Johannes Berg
From: Johannes Berg Add options to strictly validate messages and dump messages, sometimes perhaps validating dump messages non-strictly may be required, so add an option for that as well. Since none of this can really be applied to existing commands, set the options everwhere using the

[PATCH v2 3/5] netlink: re-add parse/validate functions in strict mode

2019-04-26 Thread Johannes Berg
From: Johannes Berg This re-adds the parse and validate functions like nla_parse() that are now actually strict after the previous rename and were just split out to make sure everything is converted (and if not compilation of the previous patch would fail.) Signed-off-by: Johannes Berg

[PATCH v2 0/5] strict netlink validation

2019-04-26 Thread Johannes Berg
Here's a respin, with the following changes: * change message when rejecting unknown attribute types (David Ahern) * drop nl80211 patch - I'll apply it separately * remove NL_VALIDATE_POLICY - we have a lot of calls to nla_parse() that really should be without a policy as it has previously be

[PATCH v2 4/5] netlink: add strict parsing for future attributes

2019-04-26 Thread Johannes Berg
From: Johannes Berg Unfortunately, we cannot add strict parsing for all attributes, as that would break existing userspace. We currently warn about it, but that's about all we can do. For new attributes, however, the story is better: nobody is using them, so we can reject bad sizes. Also

[PATCH v2 1/5] netlink: add NLA_MIN_LEN

2019-04-26 Thread Johannes Berg
From: Johannes Berg Rather than using NLA_UNSPEC for this type of thing, use NLA_MIN_LEN so we can make NLA_UNSPEC be NLA_REJECT under certain conditions for future attributes. While at it, also use NLA_EXACT_LEN for the struct example. Signed-off-by: Johannes Berg --- include/net/netlink.h

Re: cellular modem driver APIs

2019-04-15 Thread Johannes Berg
On Sun, 2019-04-14 at 13:09 -0600, Subash Abhinov Kasiviswanathan wrote: > > Hmm, not sure I understand this. If you do RPS/RSS then that's a > > hardware function, and the netdev doesn't really come into play > > immediately? If the underlying driver directly deals with multiple > > netdevs that'

Re: cellular modem driver APIs

2019-04-12 Thread Johannes Berg
On Fri, 2019-04-12 at 16:27 +0200, Bjørn Mork wrote: > Johannes Berg writes: > > On Wed, 2019-04-10 at 21:54 -0600, Subash Abhinov Kasiviswanathan wrote: > > > > > These packets will be processed as raw IP muxed frames on the PC as > > > well, not as ethernet

Re: cellular modem driver APIs

2019-04-12 Thread Johannes Berg
On Wed, 2019-04-10 at 21:54 -0600, Subash Abhinov Kasiviswanathan wrote: > > > We need raw IP frames from a embedded device transmitted to a PC > > > and vice versa. > > > > Sure. But you just need to encap them in some kind of ethernet frame to > > transport them on the wire, but don't really ne

Re: cellular modem driver APIs

2019-04-08 Thread Johannes Berg
On Sat, 2019-04-06 at 19:20 +0200, Daniele Palmas wrote: > > the qmi_wwan sysfs qmap feature, being very easy to use, is serving > well for me and customers of the company I work for (mainly directly > with libqmi, not ModemManager), Yeah, I don't doubt this. In fact, we could arguably provide t

Re: cellular modem driver APIs

2019-04-08 Thread Johannes Berg
On Thu, 2019-04-04 at 22:45 -0600, Subash Abhinov Kasiviswanathan wrote: > On 2019-04-04 14:38, Johannes Berg wrote: > > Hi, > > > > > The normal mode of operation of rmnet is using the rmnet netdevices > > > in an embedded device. > > > > Sure. Can

[RFC] netlink: limit recursion depth in policy validation

2019-04-05 Thread Johannes Berg
From: Johannes Berg Now that we have nested policies, we can theoretically recurse forever parsing attributes if a (sub-)policy refers back to a higher level one. This is a situation that has happened in nl80211, and we've avoided it there by not linking it. Add some code to netlink parsi

[RFC 4/7] netlink: allow NLA_MSECS to have range validation

2019-04-05 Thread Johannes Berg
From: Johannes Berg Since NLA_MSECS is really equivalent to NLA_U64, allow it to have range validation as well. Signed-off-by: Johannes Berg --- include/net/netlink.h | 6 -- lib/nlattr.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/net/netlink.h

[RFC 7/7] netlink: add infrastructure to expose policies to userspace

2019-04-05 Thread Johannes Berg
From: Johannes Berg Add, and use in generic netlink, helpers to dump out a netlink policy to userspace, including all the range validation data, nested policies etc. This lets userspace discover what the kernel understands. For families/commands other than generic netlink, the helpers need to

[RFC 2/7] netlink: remove type-unsafe validation_data pointer

2019-04-05 Thread Johannes Berg
From: Johannes Berg In the netlink policy, we currently have a void *validation_data that's pointing to different things: * a u32 value for bitfield32, * the netlink policy for nested/nested array * the string for NLA_REJECT Remove the pointer and place appropriate type-safe items i

[RFC 3/7] netlink: extend policy range validation

2019-04-05 Thread Johannes Berg
From: Johannes Berg Using a pointer to a struct indicating the min/max values, extend the ability to do range validation for arbitrary values. Small values in the s16 range can be kept in the policy directly. Signed-off-by: Johannes Berg --- include/net/netlink.h | 45 + lib

[RFC 6/7] netlink: factor out policy range helpers

2019-04-05 Thread Johannes Berg
From: Johannes Berg Add helpers to get the policy's signed/unsigned range validation data. Signed-off-by: Johannes Berg --- include/net/netlink.h | 5 +++ lib/nlattr.c | 95 +-- 2 files changed, 79 insertions(+), 21 deletions(-) diff --

[RFC 5/7] netlink: remove NLA_EXACT_LEN_WARN

2019-04-05 Thread Johannes Berg
From: Johannes Berg Use a validation type instead, so we can later expose the NLA_* values to userspace for policy descriptions. Signed-off-by: Johannes Berg --- include/net/netlink.h | 15 --- lib/nlattr.c | 16 ++-- 2 files changed, 18 insertions(+), 13

[RFC 1/7] netlink: expose policy to userspace

2019-04-05 Thread Johannes Berg
Now that it's working, here's the first draft of the code to expose the netlink policy to userspace. One thing I didn't think I would do but did anyway now is to map the NLA_* type to a new attribute, and translate it for userspace. This may not be the most convenient, but I think we would prefer

[RFC 1/7] nl80211: fix NL80211_ATTR_FTM_RESPONDER policy

2019-04-05 Thread Johannes Berg
From: Johannes Berg The nested policy here should be established using the NLA_POLICY_NESTED() macro so the length is properly filled in. Fixes: 81e54d08d9d8 ("cfg80211: support FTM responder configuration/statistics") Signed-off-by: Johannes Berg --- net/wireless/nl80211.c | 6 ++--

Re: cellular modem driver APIs

2019-04-04 Thread Johannes Berg
On Thu, 2019-04-04 at 22:38 +0200, Johannes Berg wrote: > > The bridge mode is used only for testing by sending frames > > without de-muxing to some other driver such as a USB netdev so packets > > can be parsed on a tethered PC. > > Yeah, I get it, it's just done

Re: cellular modem driver APIs

2019-04-04 Thread Johannes Berg
Hi, > The normal mode of operation of rmnet is using the rmnet netdevices > in an embedded device. Sure. Can you say what driver this would typically live on top of? I'm actually a bit surprised to find out this isn't really a driver :-) In my view right now, I'd recommend splitting rmnet into t

Re: cellular modem driver APIs

2019-04-04 Thread Johannes Berg
Hi, > Thanks a lot for doing this! Being responsible for most of the issues > you point out, I can only say that you have my full support if you want > to change any of it. :-) > My pathetic excuses below are just meant to clarify why things are the > way they are. They are not a defense for s

cellular modem driver APIs

2019-04-03 Thread Johannes Berg
Hi all, I've been looking at modem drivers, to see what the APIs are to interact with them, and while I originally thought I had the story sorted out ... not at all. Here's the current things we seem to be doing: (1) Channels are created/encoded as VLANs (cdc_mbim) This is ... strange a

[RFC v3 3/6] netlink: re-add parse/validate functions in strict mode

2019-03-25 Thread Johannes Berg
From: Johannes Berg This re-adds the parse and validate functions like nla_parse() that are now actually strict after the previous rename and were just split out to make sure everything is converted (and if not compilation of the previous patch would fail.) Signed-off-by: Johannes Berg

[RFC v3 4/6] netlink: add strict parsing for future attributes

2019-03-25 Thread Johannes Berg
From: Johannes Berg Unfortunately, we cannot add strict parsing for all attributes, as that would break existing userspace. We currently warn about it, but that's about all we can do. For new attributes, however, the story is better: nobody is using them, so we can reject bad sizes. Also

[RFC v3 5/6] genetlink: optionally validate strictly/dumps

2019-03-25 Thread Johannes Berg
From: Johannes Berg Add options to strictly validate messages and dump messages, sometimes perhaps validating dump messages non-strictly may be required, so add an option for that as well. Since none of this can really be applied to existing commands, set the options everwhere using the

[RFC v3 6/6] nl80211: tag policies with strict_start_type

2019-03-25 Thread Johannes Berg
From: Johannes Berg Tag all the nl80211 policies with strict_start_type so that strict validation is done for all types that we have a policy for. Signed-off-by: Johannes Berg --- net/wireless/nl80211.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/net/wireless

[RFC v3 1/6] netlink: add NLA_MIN_LEN

2019-03-25 Thread Johannes Berg
From: Johannes Berg Rather than using NLA_UNSPEC for this type of thing, use NLA_MIN_LEN so we can make NLA_UNSPEC be NLA_REJECT under certain conditions for future attributes. While at it, also use NLA_EXACT_LEN for the struct example. Signed-off-by: Johannes Berg --- include/net/netlink.h

[RFC v3 0/6] netlink strict validation

2019-03-25 Thread Johannes Berg
Here's yet another respin. The big change since v2 is replacing the 2nd patch by one that actually makes each validation bit configurable. The old "strict" mode ends up setting 2 of the 5 bits, the new default (and very strict) mode ends up with all 5 bits, of course. This was inspired by a side d

[RFC v2 3/6] netlink: re-add parse/validate functions in strict mode

2019-03-22 Thread Johannes Berg
From: Johannes Berg This re-adds the parse and validate functions like nla_parse() that are now actually strict after the previous rename and were just split out to make sure everything is converted (and if not compilation of the previous patch would fail.) Signed-off-by: Johannes Berg

[RFC v2 5/6] genetlink: optionally validate strictly/dumps

2019-03-22 Thread Johannes Berg
From: Johannes Berg Add options to strictly validate messages and dump messages, sometimes perhaps validating dump messages non-strictly may be required, so add an option for that as well. Since none of this can really be applied to existing commands, set the options everwhere using the

[RFC v2 0/6] strict netlink validation

2019-03-22 Thread Johannes Berg
This version gets us to where I wanted to be: strict parsing commandattribute attribute message oldold -- oldnew X- new*XX Additionally, it does lots of cross-tree renam

[RFC v2 6/6] nl80211: tag policies with strict_start_type

2019-03-22 Thread Johannes Berg
From: Johannes Berg Tag all the nl80211 policies with strict_start_type so that strict validation is done for all types that we have a policy for. Signed-off-by: Johannes Berg --- net/wireless/nl80211.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/net/wireless

[RFC v2 1/6] netlink: add NLA_MIN_LEN

2019-03-22 Thread Johannes Berg
From: Johannes Berg Rather than using NLA_UNSPEC for this type of thing, use NLA_MIN_LEN so we can make NLA_UNSPEC be NLA_REJECT under certain conditions for future attributes. While at it, also use NLA_EXACT_LEN for the struct example. Signed-off-by: Johannes Berg --- include/net/netlink.h

[RFC v2 4/6] netlink: add strict parsing for future attributes

2019-03-22 Thread Johannes Berg
From: Johannes Berg Unfortunately, we cannot add strict parsing for all attributes, as that would break existing userspace. We currently warn about it, but that's about all we can do. For new attributes, however, the story is better: nobody is using them, so we can reject bad sizes. Also

Re: [RFC 1/6] netlink: add nlmsg_validate_strict() & nla_validate_strict()

2019-03-21 Thread Johannes Berg
On Thu, 2019-03-21 at 23:50 +0100, Florian Westphal wrote: > Johannes Berg wrote: > > + * nla_validate_strict - Strictly validate a stream of attributes > > + * @head: head of attribute stream > > + * @len: length of attribute stream > > + * @maxtype: maximum at

[RFC 5/6] netlink: add strict parsing for future attributes

2019-03-21 Thread Johannes Berg
From: Johannes Berg Unfortunately, we cannot add strict parsing for all attributes, as that would break existing userspace. We currently warn about it, but that's about all we can do. For new attributes, however, the story is better: nobody is using them, so we can reject bad sizes. Also

[RFC 3/6] netlink: add NLA_MIN_LEN

2019-03-21 Thread Johannes Berg
From: Johannes Berg Rather than using NLA_UNSPEC for this type of thing, use NLA_MIN_LEN so we can make NLA_UNSPEC be NLA_REJECT under certain conditions for future attributes. While at it, also use NLA_EXACT_LEN for the struct example. Signed-off-by: Johannes Berg --- include/net/netlink.h

[RFC 0/7] netlink/genetlink: stricter parsing

2019-03-21 Thread Johannes Berg
It seems that everytime David and I meet, we have further ideas for netlink ;-) This time, we talked about attribute parsing and making policy parsing (even) stricter. I'm not entirely happy with this patchset, due to the mistake David made when he added the strict parsing. At that time, the stri

[RFC 4/6] genetlink: optionally validate strictly/dumps

2019-03-21 Thread Johannes Berg
From: Johannes Berg Add options to strictly validate messages and dump messages, sometimes perhaps validating dump messages non-strictly may be required, so add an option for that as well. Since none of this can really be applied to existing commands, set the options everwhere using the

[RFC 6/6] nl80211: tag policies with strict_start_type

2019-03-21 Thread Johannes Berg
From: Johannes Berg Tag all the nl80211 policies with strict_start_type so that strict validation is done for all types that we have a policy for. Signed-off-by: Johannes Berg --- net/wireless/nl80211.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/net/wireless

[RFC 2/6] genetlink: add genlmsg_parse_strict()

2019-03-21 Thread Johannes Berg
From: Johannes Berg Signed-off-by: Johannes Berg --- include/net/genetlink.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 6850c7b1a3a6..4a25c341244c 100644 --- a/include/net/genetlink.h +++ b/include/net

[RFC 1/6] netlink: add nlmsg_validate_strict() & nla_validate_strict()

2019-03-21 Thread Johannes Berg
From: Johannes Berg These are needed since we want to separate validation and parsing in some cases, e.g. in generic netlink to ensure that dump messages are valid, but we don't typically parse them. Signed-off-by: Johannes Berg --- include/net/netlink.h | 26 +

[PATCH] genetlink: make policy common to family

2019-03-21 Thread Johannes Berg
From: Johannes Berg Since maxattr is common, the policy can't really differ sanely, so make it common as well. The only user that did in fact manage to make a non-common policy is taskstats, which has to be really careful about it (since it's still using a common maxattr!). This is

Re: [PATCH] rsi: Fix NULL pointer dereference in kmalloc

2019-03-03 Thread Johannes Berg
On Sat, 2019-03-02 at 14:31 -0600, Aditya Pakki wrote: > kmalloc can fail in rsi_register_rates_channels but memcpy still attempts > to write to channels. The patch checks and avoids such a situation. > > Signed-off-by: Aditya Pakki > --- > drivers/net/wireless/rsi/rsi_91x_mac80211.c | 10 ++

Re: [PATCH RFC] mac80211: Use IFF_ECHO to force delivery of tx_status frames

2019-03-01 Thread Johannes Berg
> Let us briefly describe our test setup to ensure everyone on this mailing > list is one the same page. > > Our general setup looks like this: > 1 $ iw wlp1s0 info > Interface wlp1s0 > ifindex 5 > wdev 0x1 > addr 4c:5e:0c:11:43:ac > type managed > wiphy 0 > txp

Re: [PATCH RFC] mac80211: Use IFF_ECHO to force delivery of tx_status frames

2019-02-26 Thread Johannes Berg
On Tue, 2019-02-26 at 14:13 +0100, Julius Niedworok wrote: > > Thank you for the explanation - I can adjust the comment, if you like to. > > > So what are you getting back after you enabled IFF_ECHO on your mac80211 > > device? > > > > Is it just a 'status' about a sent packet, or is it the pac

pull-request: mac80211-next 2019-02-22

2019-02-22 Thread Johannes Berg
nd improvements. Cody Schuffelen (1): virt_wifi: Remove REGULATORY_WIPHY_SELF_MANAGED Herbert Xu (2): mac80211: Use rhashtable_lookup_get_insert_fast instead of racy code rhashtable: Remove obsolete rhashtable_walk_init function Johannes Berg (13):

pull-request: mac80211 2019-02-22

2019-02-22 Thread Johannes Berg
Hi Dave, So ... I thought there weren't going to be any more patches when I asked you to apply that mac80211 one, but now a few days later I still ended up with three that are current and possibly even stable material. Please pull and let me know if there's any problem. Thanks, johannes The f

Re: [PATCH] cfg80211: reg: Fix use-after-free in call_crda

2019-02-22 Thread Johannes Berg
Hi, > In function reg_query_database, query_regdb_file call > request_firmware_nowait to do request_firmware asynchronously, > which need the caller hold the reference of dev, otherwise it will > do put_device freeing '®_pdev->dev'. After that, call_crda access > the dev will trigger use-after-fre

Re: bug report: iwlwifi: mvm: support mac80211 TXQs model

2019-02-20 Thread Johannes Berg
On Wed, 2019-02-20 at 14:40 +, Colin Ian King wrote: > > ..when the used_hw_queues initialization was removed: > > @@ -360,8 +300,6 @@ int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, > struct ieee80211_vif *vif) > mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, > iwl_

[PATCH net] mac80211: mesh: fix missing unlock on error in table_path_del()

2019-02-18 Thread Johannes Berg
ot;) Acked-by: Herbert Xu Signed-off-by: Wei Yongjun Signed-off-by: Johannes Berg --- Dave, can you take this directly? I see little value in sending a pull request for this one patch (but if you prefer can do so.) --- net/mac80211/mesh_pathtbl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletio

pull-request: mac80211 2019-02-15

2019-02-15 Thread Johannes Berg
Hi Dave, It's clear things are winding down, this is basically just the stuff from Herbert that we've been discussing. I threw in a simple error path fix, mostly because it's simple :-) Please pull and let me know if there's any problem. Thanks, johannes The following changes since commit f9b

Re: [PATCH AUTOSEL 3.18 15/16] cfg80211: extend range deviation for DMG

2019-02-15 Thread Johannes Berg
On Thu, 2019-02-14 at 21:15 -0500, Sasha Levin wrote: > From: Chaitanya Tata > > [ Upstream commit 93183bdbe73bbdd03e9566c8dc37c9d06b0d0db6 ] > > Recently, DMG frequency bands have been extended till 71GHz, so extend > the range check till 20GHz (45-71GHZ), else some channels will be marked > as

Re: [v3 PATCH 0/4] mac80211: Fix incorrect usage of rhashtable walk API

2019-02-15 Thread Johannes Berg
> The first two patches in this series are bug fixes and should be > backported to stable. > > They fixes a number of issues with the use of the rhashtable API > in mac80211. First of all it converts the use of rashtable walks over > to a simple linked list. This is because an rhashtable walk is

Re: [PATCH 2/4] mac80211: Free mpath object when rhashtable insertion fails

2019-02-13 Thread Johannes Berg
On Wed, 2019-02-13 at 22:39 +0800, Herbert Xu wrote: > + if (ret != -EEXIST) > return ERR_PTR(ret); Surely that should still be "if (ret && ret != -EEXIST)" otherwise you return for the success case too? or "else if"? I'd probably say we should combine all those ifs into somethi

Re: [v2 PATCH 0/4] mac80211: Fix incorrect usage of rhashtable walk API

2019-02-13 Thread Johannes Berg
On Wed, 2019-02-13 at 22:38 +0800, Herbert Xu wrote: > Hi: > > The first two patches in this series are bug fixes and should be > backported to stable. > > They fixes a number of issues with the use of the rhashtable API > in mac80211. First of all it converts the use of rashtable walks over > t

Re: linux-next: Tree for Feb 11 (wireless/80211)

2019-02-13 Thread Johannes Berg
Thanks for the heads-up, Randy. We'd seen separate build bot reports on this as well. > ERROR: "__umoddi3" [net/wireless/cfg80211.ko] undefined! > ERROR: "__umoddi3" [net/mac80211/mac80211.ko] undefined! Should be fixed as of yesterday, let me know if it reappears. johannes

Re: [PATCH v2] rhashtable: make walk safe from softirq context

2019-02-12 Thread Johannes Berg
On Tue, 2019-02-12 at 10:43 -0800, David Miller wrote: > Herbert and Johannes, I need some guidance. > > It seems Herbert wants the softirq usage of rhashtables removed, Well, specifically of rhashtable walkers. I can only concede that he's right in that a hashtable walk during softirq (or even

pull-request: mac80211 2019-02-12

2019-02-12 Thread Johannes Berg
80211: Fix FTM per burst maximum value Ilan Peer (1): mac80211: Fix Tx aggregation session tear down with ITXQs Johannes Berg (5): cfg80211: pmsr: fix MAC address setting cfg80211: pmsr: fix abort locking mac80211: call drv_ibss_join() on restart cfg80211: pmsr: r

Re: [PATCH v2] rhashtable: make walk safe from softirq context

2019-02-07 Thread Johannes Berg
On Fri, 2019-02-08 at 05:48 +0800, Herbert Xu wrote: > On Thu, Feb 07, 2019 at 02:50:54PM +0100, Johannes Berg wrote: > > > > > This interface wasn't designed for use in softirq contexts. > > > > Well, it clearly was used there. You even gave it a gfp_t argumen

Re: [PATCH v2] rhashtable: make walk safe from softirq context

2019-02-07 Thread Johannes Berg
> This interface wasn't designed for use in softirq contexts. Well, it clearly was used there. You even gave it a gfp_t argument in rhashtable_walk_init(), so you can't really claim it wasn't designed for this. I see now that it's ignored, but still? > Could you please show me who is doing this

[PATCH v2] rhashtable: make walk safe from softirq context

2019-02-06 Thread Johannes Berg
From: Johannes Berg When an rhashtable walk is done from softirq context, we rightfully get a lockdep complaint saying that we could get a softirq in the middle of a rehash, and thus deadlock on &ht->lock. This happened e.g. in mac80211 as it does a walk in softirq context. Fix this b

Re: [PATCH] rhashtable: use irq-safe spinlock in rhashtable_rehash_table()

2019-02-06 Thread Johannes Berg
On Tue, 2019-02-05 at 15:37 +0100, Johannes Berg wrote: > From: Johannes Berg > > When an rhashtabl walk is done from irq/bh context, we rightfully > get a lockdep complaint saying that we could get a (soft-)IRQ in > the middle of a rehash. This happened e.g. in mac80211 as it d

[PATCH] rhashtable: use irq-safe spinlock in rhashtable_rehash_table()

2019-02-05 Thread Johannes Berg
From: Johannes Berg When an rhashtabl walk is done from irq/bh context, we rightfully get a lockdep complaint saying that we could get a (soft-)IRQ in the middle of a rehash. This happened e.g. in mac80211 as it does a walk in soft-irq context. Fix this by using irq-safe locking here. We don&#

pull-request: mac80211-next 2019-02-01

2019-02-01 Thread Johannes Berg
to indicate missing/inaccurate tx A-MPDU length Gustavo A. R. Silva (1): cfg80211: mark expected switch fall-throughs Johannes Berg (5): mac80211: remove unused variable Merge remote-tracking branch 'net-next/master' into mac80211-next netlink: reduce NLA_PO

pull-request: mac80211 2019-02-01

2019-02-01 Thread Johannes Berg
ional condition, needs to rerun the checks after that condition changes Felix Fietkau (1): mac80211: ensure that mgmt tx skbs have tailroom for encryption Johannes Berg (1): cfg80211: call disconnect_wk when AP stops

Re: [PATCH net 0/4] various compat ioctl fixes

2019-01-28 Thread Johannes Berg
On Mon, 2019-01-28 at 11:22 -0800, David Miller wrote: > I see some back and forth between you and Al, where do we stand at > this point? I don't really know. I think neither of us _likes_ this code, in particular the whole copy_in_user() thing is quite a mess. The copy_in_user() also means that

[PATCH] decnet: fix DN_IFREQ_SIZE

2019-01-26 Thread Johannes Berg
From: Johannes Berg Digging through the ioctls with Al because of the previous patches, we found that on 64-bit decnet's dn_dev_ioctl() is wrong, because struct ifreq::ifr_ifru is actually 24 bytes (not 16 as expected from struct sockaddr) due to the ifru_map and ifru_settings members. Cl

Re: [PATCH net 2/4] Revert "kill dev_ifsioc()"

2019-01-26 Thread Johannes Berg
On Sat, 2019-01-26 at 18:49 +0100, Johannes Berg wrote: > On Sat, 2019-01-26 at 18:45 +0100, Johannes Berg wrote: > > > > Yes and no. It *sometimes* (actually rarely, since we don't really have > > dev_ioctls that much, afaict) hits this, but it could also just hit &g

<    1   2   3   4   5   6   7   8   9   10   >