mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 23:21:31 +00:00
[RTNETLINK]: Fix netdevice name corruption
When changing a device by ifindex without including a IFLA_IFNAME attribute, the ifname variable contains random garbage and is used to change the device name. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d1d9facfd1
commit
78e5b8916e
@ -394,6 +394,8 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
|
||||
if (tb[IFLA_IFNAME])
|
||||
nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
|
||||
else
|
||||
ifname[0] = '\0';
|
||||
|
||||
err = -EINVAL;
|
||||
ifm = nlmsg_data(nlh);
|
||||
|
Loading…
Reference in New Issue
Block a user