[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6e28cea9-d615-449d-9c68-aa155efc8444@lunn.ch>
Date: Fri, 2 Jun 2023 17:37:19 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Ding Hui <dinghui@...gfor.com.cn>
Cc: Alexander H Duyck <alexander.duyck@...il.com>, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
pengdonglin@...gfor.com.cn, huangcun@...gfor.com.cn
Subject: Re: [PATCH net-next] net: ethtool: Fix out-of-bounds copy to user
> > Also, RTNL should be held during the time both calls are made into the
> > driver. So nothing from userspace should be able to get in the middle
> > of these calls to change the number of queues.
> >
>
> The RTNL lock is already be held during every each ioctl in dev_ethtool().
>
> rtnl_lock();
> rc = __dev_ethtool(net, ifr, useraddr, ethcmd, state);
> rtnl_unlock();
Yes, exactly. So the kernel should be safe from buffer overruns.
Userspace will not get more than it asked for. It might get less, and
it could be different to the previous calls. But i'm not aware of
anything which says anything about the consistency between different
invocations of ethtool -S.
Andrew
Powered by blists - more mailing lists