mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ding Hui <dinghui@sangfor.com.cn>
To: Simon Horman <simon.horman@corigine.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, intel-wired-lan@lists.osuosl.org,
	jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com,
	keescook@chromium.org, grzegorzx.szczurek@intel.com,
	mateusz.palczewski@intel.com, mitch.a.williams@intel.com,
	gregory.v.rose@intel.com, jeffrey.t.kirsher@intel.com,
	michal.kubiak@intel.com, madhu.chittim@intel.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org, pengdonglin@sangfor.com.cn,
	huangcun@sangfor.com.cn
Subject: Re: [PATCH net v3 1/2] iavf: Fix use-after-free in free_netdev
Date: Mon, 1 May 2023 15:41:18 +0800	[thread overview]
Message-ID: <730cf5ed-2239-34f7-79a5-ffa4d9bb8fae@sangfor.com.cn> (raw)
In-Reply-To: <ZE9j4CHtQbm5S3cg@corigine.com>

On 2023/5/1 15:01, Simon Horman wrote:
> On Sat, Apr 29, 2023 at 09:20:21PM +0800, Ding Hui wrote:
>> We do netif_napi_add() for all allocated q_vectors[], but potentially
>> do netif_napi_del() for part of them, then kfree q_vectors and leave
>> invalid pointers at dev->napi_list.
>>
>> ...
>>
>> Although the patch #2 (of 2) can avoid the issuse triggered by this
>> repro.sh, there still are other potential risks that if num_active_queues
>> is changed to less than allocated q_vectors[] by unexpected, the
>> mismatched netif_napi_add/del() can also casue UAF.
> 
> nit: ./checkpatch --codespell tells me:
> 
>       s/casue/cause/
> 

Sorry, I'll fix it in v4.

>> Since we actually call netif_napi_add() for all allocated q_vectors
>> unconditionally in iavf_alloc_q_vectors(), so we should fix it by
>> letting netif_napi_del() match to netif_napi_add().
>>
>> Fixes: 5eae00c57f5e ("i40evf: main driver core")
>> Signed-off-by: Ding Hui <dinghui@sangfor.com.cn>
>> Cc: Donglin Peng <pengdonglin@sangfor.com.cn>
>> Cc: Huang Cun <huangcun@sangfor.com.cn>
>> Reviewed-by: Simon Horman <simon.horman@corigine.com>
>> Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
>> Reviewed-by: Madhu Chittim <madhu.chittim@intel.com>
> 
> 
> 

-- 
Thanks,
-dinghui


  reply	other threads:[~2023-05-01  7:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-29 13:20 [PATCH net v3 0/2] iavf: Fix issues when setting channels concurrency with removing Ding Hui
2023-04-29 13:20 ` [PATCH net v3 1/2] iavf: Fix use-after-free in free_netdev Ding Hui
2023-05-01  7:01   ` Simon Horman
2023-05-01  7:41     ` Ding Hui [this message]
2023-04-29 13:20 ` [PATCH net v3 2/2] iavf: Fix out-of-bounds when setting channels on remove Ding Hui

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=730cf5ed-2239-34f7-79a5-ffa4d9bb8fae@sangfor.com.cn \
    --to=dinghui@sangfor.com.cn \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gregory.v.rose@intel.com \
    --cc=grzegorzx.szczurek@intel.com \
    --cc=huangcun@sangfor.com.cn \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madhu.chittim@intel.com \
    --cc=mateusz.palczewski@intel.com \
    --cc=michal.kubiak@intel.com \
    --cc=mitch.a.williams@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pengdonglin@sangfor.com.cn \
    --cc=simon.horman@corigine.com \
    /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®