[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1452996393.2519.33.camel@decadent.org.uk>
Date: Sun, 17 Jan 2016 02:06:33 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: kan.liang@...el.com, netdev@...r.kernel.org, davem@...emloft.net,
bwh@...nel.org
Cc: jesse.brandeburg@...el.com, andi@...stfloor.org,
f.fainelli@...il.com, alexander.duyck@...il.com,
jeffrey.t.kirsher@...el.com, shannon.nelson@...el.com,
carolyn.wyborny@...el.com, donald.c.skidmore@...el.com,
mitch.a.williams@...el.com, ogerlitz@...lanox.com,
edumazet@...gle.com, jiri@...lanox.com, sfeldma@...il.com,
gospo@...ulusnetworks.com, sasha.levin@...cle.com,
dsahern@...il.com, tj@...nel.org, cascardo@...hat.com,
corbet@....net
Subject: Re: [PATCH V3 2/6] net/ethtool: support get coalesce per queue
On Thu, 2016-01-14 at 09:08 -0500, kan.liang@...el.com wrote:
[...]
> @@ -1814,6 +1840,10 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
> case ETHTOOL_GTUNABLE:
> break;
> case ETHTOOL_PERQUEUE:
> + if (copy_from_user(&sub_cmd, useraddr + sizeof(ethcmd), sizeof(sub_cmd)))
> + return -EFAULT;
> + if (sub_cmd == ETHTOOL_GCOALESCE)
> + break;
ETHTOOL_PERQUEUE should be handled before the containing switch(), so
we can then apply the switch() to sub_cmd; something like this:
if (ethcmd == ETHTOOL_PERQUEUE) {
if (copy_from_user(&sub_cmd, useraddr + sizeof(ethcmd), sizeof(sub_cmd)))
return -EFAULT;
} else {
sub_cmd = ethcmd;
}
switch (sub_cmd) {
...
}
Ben.
> default:
> if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
> return -EPERM;
--
Ben Hutchings
Theory and practice are closer in theory than in practice.
- John Levine, moderator of comp.compilers
Download attachment "signature.asc" of type "application/pgp-signature" (812 bytes)
Powered by blists - more mailing lists