[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161115.220108.1225196299725031215.davem@davemloft.net>
Date: Tue, 15 Nov 2016 22:01:08 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: cugyly@....com
Cc: netdev@...r.kernel.org, Linyu.Yuan@...atel-sbell.com.cn
Subject: Re: [PATCH] net: ioctl SIOCSIFADDR minor cleanup
From: yuan linyu <cugyly@....com>
Date: Tue, 15 Nov 2016 20:44:59 +0800
> @@ -1063,10 +1063,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
> if (!ifa)
> break;
> INIT_HLIST_NODE(&ifa->hash);
> - if (colon)
> - memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ);
> - else
> - memcpy(ifa->ifa_label, dev->name, IFNAMSIZ);
> + memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ);
This is an incorrect and untested change.
If there is a colon character in ifr.ifr_name, earlier in this function
we will:
1) First replace that colon with a NULL character.
2) Perform __dev_get_by_name() on the result.
3) Put the ":" colon character back into ifr.ifr_name
So the two strings ifr.ifr_name and dev->name can in fact be different
here. Therefore the code has to be left as it is.
Powered by blists - more mailing lists