netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 1/2] netlink: add NLA_U8_BUGGY attribute type
@ 2017-12-02 20:23 Johannes Berg
  2017-12-02 20:23 ` [PATCH net 2/2] nl80211: use NLA_U8_BUGGY for two attributes Johannes Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Johannes Berg @ 2017-12-02 20:23 UTC (permalink / raw)
  To: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: j, David Ahern, Johannes Berg

From: Johannes Berg <johannes.berg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

This netlink type is used only for backwards compatibility
with broken userspace that used the wrong size for a given
u8 attribute, which is now rejected. It would've been wrong
before already, since on big endian the wrong value (always
zero) would be used by the kernel, but we can't break the
existing deployed userspace - hostapd for example now fails
to initialize entirely.

We could try to fix up the big endian problem here, but we
don't know *how* userspace misbehaved - if using nla_put_u32
then we could, but we also found a debug tool (which we'll
ignore for the purposes of this regression) that was putting
the padding into the length.

Fixes: 28033ae4e0f5 ("net: netlink: Update attr validation to require exact length for some types")
Signed-off-by: Johannes Berg <johannes.berg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 include/net/netlink.h | 1 +
 lib/nlattr.c          | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/net/netlink.h b/include/net/netlink.h
index 0c154f98e987..448a9b86c959 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -180,6 +180,7 @@ enum {
 	NLA_S32,
 	NLA_S64,
 	NLA_BITFIELD32,
+	NLA_U8_BUGGY, /* don't use this - only for bug-ward compatibility */
 	__NLA_TYPE_MAX,
 };
 
diff --git a/lib/nlattr.c b/lib/nlattr.c
index 8bf78b4b78f0..2b89d25d4745 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -28,6 +28,7 @@ static const u8 nla_attr_len[NLA_TYPE_MAX+1] = {
 };
 
 static const u8 nla_attr_minlen[NLA_TYPE_MAX+1] = {
+	[NLA_U8_BUGGY]	= sizeof(u8),
 	[NLA_MSECS]	= sizeof(u64),
 	[NLA_NESTED]	= NLA_HDRLEN,
 };
-- 
2.14.2

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

end of thread, other threads:[~2017-12-05 19:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-02 20:23 [PATCH net 1/2] netlink: add NLA_U8_BUGGY attribute type Johannes Berg
2017-12-02 20:23 ` [PATCH net 2/2] nl80211: use NLA_U8_BUGGY for two attributes Johannes Berg
     [not found] ` <20171202202332.10205-1-johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2017-12-02 22:48   ` [PATCH net 1/2] netlink: add NLA_U8_BUGGY attribute type David Ahern
2017-12-05 16:31 ` David Miller
     [not found]   ` <20171205.113145.172521292247335321.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2017-12-05 16:34     ` Johannes Berg
2017-12-05 16:41       ` David Miller
2017-12-05 17:30         ` Johannes Berg
2017-12-05 17:40           ` David Miller
     [not found]             ` <20171205.124038.2265447675450126665.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2017-12-05 18:15               ` David Ahern
2017-12-05 19:08                 ` David Miller
2017-12-05 16:41       ` David Ahern
     [not found]         ` <fe8e7ad5-9579-31ce-0d02-a6c8522ba366-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-12-05 16:51           ` David Miller

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).