From: Patrick McHardy Date: Thu, 14 Sep 2006 03:35:36 +0000 (-0700) Subject: [RTNETLINK]: Fix netdevice name corruption X-Git-Tag: v2.6.19-rc1~1272^2~76 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78e5b8916e7db119850f57ce8548fbb9767078fc;p=linux-2.6 [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 Signed-off-by: David S. Miller --- diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 63b882ac28..d8e25e08cb 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);