Message ID | 20230509111148.4608-1-dinghui@sangfor.com.cn |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2800280vqo; Tue, 9 May 2023 04:22:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5smxY457X41pxc9heNILZKSS91UPAWvnzLjf7Qki0yflfIk7U7J4qQAeRUeNAJcGo9kr8l X-Received: by 2002:a05:6a20:432a:b0:100:5a09:4524 with SMTP id h42-20020a056a20432a00b001005a094524mr8422991pzk.31.1683631359977; Tue, 09 May 2023 04:22:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683631359; cv=none; d=google.com; s=arc-20160816; b=xZuJAdVelfjKKcdihMReXyWs1cn97CPzWHWg2qbjCm/jrgzqyM15tcTbe66QtldSdV 5m0ZhV6UcvGYz4ImQUftz10XmoBF/e/PjDb2D7O+x8JoRCRLYYEB86ku0+g5IBpryos8 yk6LLY3su6c4jR3tgX8cPHdDOrj3/OTDuUvW5+y9byU7HyGGCF4OXVEasV0skuKJy3EG Mqcrp5TJeDRphpQO6OkI2pKsSOFMFv4A4GIUwe4ynnIfFtkAPGK9+/VjJzkoMPBaGV6v Ykkzda+x/nJxAWYQqt5F2i7rbkUhuY5EDYNYoP2BjpzS7JFzqK2Ndr0zxRLZ8Dd8ezWf mWlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=9Tc1ASznB8km9S9z19NLiMSSW0B+aIAneCfVuwJoqCg=; b=nZQZYq9ttBXaD7xMASS9T9z9a634uQj3HaOALrnNKXC1NSpJWVrCi1dnKU9sQ/81AY MF95EfTN/5x3ORehCVc5iMGxWM/R0pKvzwQLt481voSe4AflarXlLUxJX9wxgnagjSwk ArxzyG390kXd1FLUNfXolTQEYCTt0PTWK1D9RrRM8aJpQZcu/344WRKSOLefzvbPdJZG aRUo1l8rH4+EpKKUQRVDVjOJblkYdIgioqZWWPJk3bTHBbNBBe84F967qzpirdGhUB/A 1b90gZe+wphUkO4b4rhfnWmT4y7kWBuWRZplQuCE5f9CdOBjFUOkywZird48gDKRvPag CxNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sangfor.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c129-20020a633587000000b0051384f6edeasi879422pga.537.2023.05.09.04.22.25; Tue, 09 May 2023 04:22:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sangfor.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235045AbjEILMH (ORCPT <rfc822;baris.duru.linux@gmail.com> + 99 others); Tue, 9 May 2023 07:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjEILMF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 9 May 2023 07:12:05 -0400 Received: from mail-m127104.qiye.163.com (mail-m127104.qiye.163.com [115.236.127.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C304C40FD; Tue, 9 May 2023 04:12:01 -0700 (PDT) Received: from localhost.localdomain (unknown [IPV6:240e:3b7:3277:3e50:6cb9:7ae9:9442:26ad]) by mail-m127104.qiye.163.com (Hmail) with ESMTPA id 1CF0CA402FD; Tue, 9 May 2023 19:11:53 +0800 (CST) From: Ding Hui <dinghui@sangfor.com.cn> To: 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 Cc: 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, simon.horman@corigine.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, Ding Hui <dinghui@sangfor.com.cn> Subject: [PATCH net v5 0/2] iavf: Fix issues when setting channels concurrency with removing Date: Tue, 9 May 2023 19:11:46 +0800 Message-Id: <20230509111148.4608-1-dinghui@sangfor.com.cn> X-Mailer: git-send-email 2.17.1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVlDGE8YVk9JS04eShlMHU0eGVUTARMWGhIXJBQOD1 lXWRgSC1lBWUlPSx5BSBlMQUhJTExBSB5OS0FNGBlCQUwaHkJBQk9PSUFJTRofWVdZFhoPEhUdFF lBWU9LSFVKSktISkxVSktLVUtZBg++ X-HM-Tid: 0a880035ec10b282kuuu1cf0ca402fd X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6MAg6Nzo5HD0KIyszEVEjNAw6 MRYwCwlVSlVKTUNITUhLTEpPSEpMVTMWGhIXVR8SFRwTDhI7CBoVHB0UCVUYFBZVGBVFWVdZEgtZ QVlJT0seQUgZTEFISUxMQUgeTktBTRgZQkFMGh5CQUJPT0lBSU0aH1lXWQgBWUFIS09INwY+ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765415436603838744?= X-GMAIL-MSGID: =?utf-8?q?1765415436603838744?= |
Series |
iavf: Fix issues when setting channels concurrency with removing
|
|
Message
Ding Hui
May 9, 2023, 11:11 a.m. UTC
The patchset fix two issues which can be reproduced by the following script: [root@host ~]# cat repro.sh #!/bin/bash pf_dbsf="0000:41:00.0" vf0_dbsf="0000:41:02.0" g_pids=() function do_set_numvf() { echo 2 >/sys/bus/pci/devices/${pf_dbsf}/sriov_numvfs sleep $((RANDOM%3+1)) echo 0 >/sys/bus/pci/devices/${pf_dbsf}/sriov_numvfs sleep $((RANDOM%3+1)) } function do_set_channel() { local nic=$(ls -1 --indicator-style=none /sys/bus/pci/devices/${vf0_dbsf}/net/) [ -z "$nic" ] && { sleep $((RANDOM%3)) ; return 1; } ifconfig $nic 192.168.18.5 netmask 255.255.255.0 ifconfig $nic up ethtool -L $nic combined 1 ethtool -L $nic combined 4 sleep $((RANDOM%3)) } function on_exit() { local pid for pid in "${g_pids[@]}"; do kill -0 "$pid" &>/dev/null && kill "$pid" &>/dev/null done g_pids=() } trap "on_exit; exit" EXIT while :; do do_set_numvf ; done & g_pids+=($!) while :; do do_set_channel ; done & g_pids+=($!) wait Ding Hui (2): iavf: Fix use-after-free in free_netdev iavf: Fix out-of-bounds when setting channels on remove drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 4 +++- drivers/net/ethernet/intel/iavf/iavf_main.c | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-)
Comments
On Tue, May 09, 2023 at 07:11:46PM +0800, Ding Hui wrote: > The patchset fix two issues which can be reproduced by the following script: > > [root@host ~]# cat repro.sh > #!/bin/bash > > pf_dbsf="0000:41:00.0" > vf0_dbsf="0000:41:02.0" > g_pids=() > > function do_set_numvf() > { > echo 2 >/sys/bus/pci/devices/${pf_dbsf}/sriov_numvfs > sleep $((RANDOM%3+1)) > echo 0 >/sys/bus/pci/devices/${pf_dbsf}/sriov_numvfs > sleep $((RANDOM%3+1)) > } > > function do_set_channel() > { > local nic=$(ls -1 --indicator-style=none /sys/bus/pci/devices/${vf0_dbsf}/net/) > [ -z "$nic" ] && { sleep $((RANDOM%3)) ; return 1; } > ifconfig $nic 192.168.18.5 netmask 255.255.255.0 > ifconfig $nic up > ethtool -L $nic combined 1 > ethtool -L $nic combined 4 > sleep $((RANDOM%3)) > } > > function on_exit() > { > local pid > for pid in "${g_pids[@]}"; do > kill -0 "$pid" &>/dev/null && kill "$pid" &>/dev/null > done > g_pids=() > } > > trap "on_exit; exit" EXIT > > while :; do do_set_numvf ; done & > g_pids+=($!) > while :; do do_set_channel ; done & > g_pids+=($!) > > wait > > > Ding Hui (2): > iavf: Fix use-after-free in free_netdev > iavf: Fix out-of-bounds when setting channels on remove > > drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 4 +++- > drivers/net/ethernet/intel/iavf/iavf_main.c | 6 +----- > 2 files changed, 4 insertions(+), 6 deletions(-) > > -- > 2.17.1 > For the series: Reviewed-by: Michal Kubiak <michal.kubiak@intel.com> Thanks, Michal