]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.28/rtnetlink-nul-terminate-ifla_phys_port_name-string.patch
fix up queue-5.15/mm-fix-race-between-__split_huge_pmd_locked-and-gup-.patch
[thirdparty/kernel/stable-queue.git] / releases / 4.9.28 / rtnetlink-nul-terminate-ifla_phys_port_name-string.patch
1 From foo@baz Thu May 11 11:08:24 CEST 2017
2 From: Michal Schmidt <mschmidt@redhat.com>
3 Date: Thu, 4 May 2017 16:48:58 +0200
4 Subject: rtnetlink: NUL-terminate IFLA_PHYS_PORT_NAME string
5
6 From: Michal Schmidt <mschmidt@redhat.com>
7
8
9 [ Upstream commit 77ef033b687c3e030017c94a29bf6ea3aaaef678 ]
10
11 IFLA_PHYS_PORT_NAME is a string attribute, so terminate it with \0.
12 Otherwise libnl3 fails to validate netlink messages with this attribute.
13 "ip -detail a" assumes too that the attribute is NUL-terminated when
14 printing it. It often was, due to padding.
15
16 I noticed this as libvirtd failing to start on a system with sfc driver
17 after upgrading it to Linux 4.11, i.e. when sfc added support for
18 phys_port_name.
19
20 Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
21 Signed-off-by: David S. Miller <davem@davemloft.net>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 ---
24 net/core/rtnetlink.c | 2 +-
25 1 file changed, 1 insertion(+), 1 deletion(-)
26
27 --- a/net/core/rtnetlink.c
28 +++ b/net/core/rtnetlink.c
29 @@ -1059,7 +1059,7 @@ static int rtnl_phys_port_name_fill(stru
30 return err;
31 }
32
33 - if (nla_put(skb, IFLA_PHYS_PORT_NAME, strlen(name), name))
34 + if (nla_put_string(skb, IFLA_PHYS_PORT_NAME, name))
35 return -EMSGSIZE;
36
37 return 0;