summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-09-13 20:35:36 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 15:18:50 -0700
commit78e5b8916e7db119850f57ce8548fbb9767078fc (patch)
tree1aa44a67101b354279d4edc98afc6c4ae1389a88
parentd1d9facfd1b326e0df587c96f0ee55de2ae9f946 (diff)
downloadlinux-78e5b8916e7db119850f57ce8548fbb9767078fc.tar.bz2
[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>
-rw-r--r--net/core/rtnetlink.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 63b882ac288a..d8e25e08cb7e 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -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);