Message ID | 20230419150709.24810-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 b10csp464011vqo; Wed, 19 Apr 2023 08:13:48 -0700 (PDT) X-Google-Smtp-Source: AKy350aqfQuxbGuaCIdRHCpoXUGCbF8Sxmc6Og7WzQhZJT8RbMdFpa8eKyh6hShBg/Qa+onkEKOa X-Received: by 2002:a05:6a00:2316:b0:63d:4756:6e9a with SMTP id h22-20020a056a00231600b0063d47566e9amr4291130pfh.27.1681917227935; Wed, 19 Apr 2023 08:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681917227; cv=none; d=google.com; s=arc-20160816; b=WpkWR9axmOgkAtQAbkKQYmgnnjx7xvZqDq5IjejixeMA+ZVNt8ZFpNJyP9oYvorT65 Ib2XuMBcSrYo2/1Kc7YLSm4Y1cXFPTTaEQqhsCGz8gqd0q5vSAtdC8vT/eny+sAY2HB4 Feb+swrhJWcNYVySUMQjCK1eIYUkPuXeoPCAY4XvRDDpvWWRRXR/CBMqjtXkZHHU1YmR tFx1VHxhJ27ze8bnqc9yFAbkdlWMhnt2AS01QEPZVcuX/TQFAPKDoK9pV28/FwY1ysid jxvndun3/x1gUDYOF3w8UHNwPTlFbeNGt3B5X8G3ta/xsL1oAs6HbjL0ZbZaaTGChDi9 6cNg== 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=gKu45RK/zrUJ0wwDunTdLronJyArdGpkhCQyHe15dGrbxSFqH7tHS9xmaZPIwgOSZ2 nId/6Bmz5HhGzTwTtK0htMdgX3U5YY7NVH/zOh5pngHVXnadieZoE9Lf7RiQS9sUNYIb Bh0FcX+6Rrxh0NdmmqyObeCHyMPAlcLTbsA8HWttr26oZZhy4GzZgINcskUk/rTeZAaO 6dmZIcaSnnBF805pVl9QgyYIqzEjXorur63gbVpmev903dj4BQUGHulkO9p/WzjQxfIX mBwtDVFYugAkkmbGi7y0qxljQNkJmvvcAYIILcSe/QO76Ry0vdtPbDelBa93pt5Sk1ik vkYA== 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 a19-20020aa79713000000b0063b89234a5asi9312734pfg.371.2023.04.19.08.13.32; Wed, 19 Apr 2023 08:13:47 -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 S231719AbjDSPIG (ORCPT <rfc822;peter110.wang@gmail.com> + 99 others); Wed, 19 Apr 2023 11:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbjDSPIB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 19 Apr 2023 11:08:01 -0400 Received: from mail-m11875.qiye.163.com (mail-m11875.qiye.163.com [115.236.118.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32A7B3C2B; Wed, 19 Apr 2023 08:07:56 -0700 (PDT) Received: from localhost.localdomain (unknown [113.92.156.116]) by mail-m11875.qiye.163.com (Hmail) with ESMTPA id A87DE280259; Wed, 19 Apr 2023 23:07:52 +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, 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 v2 0/2] iavf: Fix issues when setting channels concurrency with removing Date: Wed, 19 Apr 2023 23:07:07 +0800 Message-Id: <20230419150709.24810-1-dinghui@sangfor.com.cn> X-Mailer: git-send-email 2.17.1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVlCTR4aVkIfTExLTU4ZHktNSlUTARMWGhIXJBQOD1 lXWRgSC1lBWUpKSFVCSVVKTk1VSkpNWVdZFhoPEhUdFFlBWU9LSFVKSktISkxVSktLVUtZBg++ X-HM-Tid: 0a879a0eca282eb1kusna87de280259 X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6ORg6Eio5OD0JQxdKUVFMS0MS ECJPCj9VSlVKTUNKQkpNQ0xITU1NVTMWGhIXVR8SFRwTDhI7CBoVHB0UCVUYFBZVGBVFWVdZEgtZ QVlKSkhVQklVSk5NVUpKTVlXWQgBWUFJQkJINwY+ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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?1763618038869366455?= X-GMAIL-MSGID: =?utf-8?q?1763618038869366455?= |
Series |
iavf: Fix issues when setting channels concurrency with removing
|
|
Message
Ding Hui
April 19, 2023, 3:07 p.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 Wed, Apr 19, 2023 at 11:07:07PM +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(-) For the series: Reviewed-by: Michal Kubiak <michal.kubiak@intel.com> > > -- > 2.17.1 >