mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ding Hui <dinghui@sangfor.com.cn>
To: Andrew Lunn <andrew@lunn.ch>
Cc: dinghui@sangfor.com.cn,
	Alexander H Duyck <alexander.duyck@gmail.com>,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, pengdonglin@sangfor.com.cn,
	huangcun@sangfor.com.cn
Subject: Re: [PATCH net-next] net: ethtool: Fix out-of-bounds copy to user
Date: Fri, 2 Jun 2023 23:01:43 +0800	[thread overview]
Message-ID: <f7e23fe6-4d30-ef1b-a431-3ef6ec6f77ba@sangfor.com.cn> (raw)
In-Reply-To: <6110cf9f-c10e-4b9b-934d-8d202b7f5794@lunn.ch>

On 2023/6/2 8:26 下午, Andrew Lunn wrote:
>>> Changing the copy size would not fix this. The problem is the driver
>>> will be overwriting with the size that it thinks it should be using.
>>> Reducing the value that is provided for the memory allocations will
>>> cause the driver to corrupt memory.
>>>
>>
>> I noticed that, in fact I did use the returned length to allocate
>> kernel memory, and only use adjusted length to copy to user.
> 
> This is also something i checked when quickly looking at the patch. It
> does look correct.
> 

Thanks.

> 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();

-- 
Thanks,
-dinghui


  reply	other threads:[~2023-06-02 15:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01 11:28 Ding Hui
2023-06-01 15:04 ` Alexander H Duyck
2023-06-02  1:46   ` Ding Hui
2023-06-02 12:26     ` Andrew Lunn
2023-06-02 15:01       ` Ding Hui [this message]
2023-06-02 15:37         ` Andrew Lunn
2023-06-02 16:01           ` Alexander Duyck
2023-06-02 16:37             ` Andrew Lunn
2023-06-02 18:02               ` Alexander Duyck
2023-06-03  1:51                 ` Ding Hui
2023-06-03  5:55                   ` Jakub Kicinski
2023-06-03  7:11                     ` Ding Hui
2023-06-04 17:47                       ` Jakub Kicinski
2023-06-05  3:39                         ` Ding Hui
2023-06-05 18:39                           ` Jakub Kicinski
2023-06-08  9:06                             ` Ding Hui
2023-06-08 14:17                               ` Alexander Duyck
2023-06-09 15:25                                 ` Ding Hui
2023-06-09 17:13                                   ` Jakub Kicinski
2023-06-09 17:59                                     ` Alexander Duyck
2023-06-10  3:47                                       ` Ding Hui
2023-06-10  4:01                                         ` Ding Hui
2023-06-02 15:30     ` Alexander Duyck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7e23fe6-4d30-ef1b-a431-3ef6ec6f77ba@sangfor.com.cn \
    --to=dinghui@sangfor.com.cn \
    --cc=alexander.duyck@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=huangcun@sangfor.com.cn \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pengdonglin@sangfor.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®