[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8729016553E3654398EA69218DA29EEF0E42F73A@cnshjmbx02>
Date: Wed, 16 Nov 2016 03:13:31 +0000
From: YUAN Linyu <Linyu.Yuan@...atel-sbell.com.cn>
To: David Miller <davem@...emloft.net>,
"cugyly@....com" <cugyly@....com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH] net: ioctl SIOCSIFADDR minor cleanup
hi david,
> -----Original Message-----
> From: netdev-owner@...r.kernel.org [mailto:netdev-owner@...r.kernel.org]
> On Behalf Of David Miller
> Sent: Wednesday, November 16, 2016 11:01 AM
> To: cugyly@....com
> Cc: netdev@...r.kernel.org; YUAN Linyu
> 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.
Here we assign value to ifa->ifa_label.
orginal code means when reqest name have colon, then label name will have colon.
If request name have no colon, label name will same as dev-name, it's also have no colon.
So assign label to request name will do same thing as original code.
thanks
Powered by blists - more mailing lists