mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-09-22 04:31:58 +08: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])
|
if (tb[IFLA_IFNAME])
|
||||||
nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
|
nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
|
||||||
|
else
|
||||||
|
ifname[0] = '\0';
|
||||||
|
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
ifm = nlmsg_data(nlh);
|
ifm = nlmsg_data(nlh);
|
||||||
|
Loading…
Reference in New Issue
Block a user