Skip to contentSkip to conversation

Patch "rtnetlink: NUL-terminate IFLA_PHYS_PORT_NAME string" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message May 11, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

rtnetlink: NUL-terminate IFLA_PHYS_PORT_NAME string

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
rtnetlink-nul-terminate-ifla_phys_port_name-string.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu May 11 12:38:23 CEST 2017

From: Michal Schmidt <[email protected]>
Date: Thu, 4 May 2017 16:48:58 +0200
Subject: rtnetlink: NUL-terminate IFLA_PHYS_PORT_NAME string

From: Michal Schmidt <[email protected]>

[ Upstream commit 77ef033b687c3e030017c94a29bf6ea3aaaef678 ]

IFLA_PHYS_PORT_NAME is a string attribute, so terminate it with \0. Otherwise libnl3 fails to validate netlink messages with this attribute. "ip -detail a" assumes too that the attribute is NUL-terminated when printing it. It often was, due to padding.

I noticed this as libvirtd failing to start on a system with sfc driver after upgrading it to Linux 4.11, i.e. when sfc added support for phys_port_name.

---
 net/core/rtnetlink.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/rtnetlink.c +1 -1
@@ -1018,7 +1018,7 @@ static int rtnl_phys_port_name_fill(stru
 		return err;
 	}
 
-	if (nla_put(skb, IFLA_PHYS_PORT_NAME, strlen(name), name))
+	if (nla_put_string(skb, IFLA_PHYS_PORT_NAME, name))
 		return -EMSGSIZE;
 
 	return 0;

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/rtnetlink-nul-terminate-ifla_phys_port_name-string.patch