Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp87163rwe; Tue, 18 Apr 2023 18:07:27 -0700 (PDT) X-Google-Smtp-Source: AKy350Y9NqU6QJVlM+QMhMS5LPXB7pJZdEjflxUl6M5PWXDhdtuoLndk536BwAgB1eNv6U3jiy5I X-Received: by 2002:a05:6a00:1a4c:b0:63d:3789:733f with SMTP id h12-20020a056a001a4c00b0063d3789733fmr1329314pfv.15.1681866446978; Tue, 18 Apr 2023 18:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681866446; cv=none; d=google.com; s=arc-20160816; b=QoJoYCQjPoA+NmpfhMWfgOw2I2GusCcxlYc586sutD2KDPRNZYVJtwE99N2N4YZN3h 6xm3Z7c/KyBW61GjNg4OFJ4qtyl6ra6YZyxtdek2CoeSuvmJPww55lt7lwV1dPCqYN1Y k/zaWIXb0YpR5kbOu0SRdblsGCona+C9LiBykLIRmPh5Wn4rLtPAzftOPiaSQFZCEgbi RfA9X8StJYqFBdCm70Vt2PDMfKfa0/CBIZV4mALgjiY/DMvZkJtjo+dOC6xR3DPypxyp SzTeB79o2aeWWvsGqPZWMTZzR0CnlbtEdBDZ6d3A7zxfFpD4Wzjfj7yfG3lmD+5NGSz9 QF+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=76HR0SE1qqiDL2NJwKs8WgAB8G/EvTs6TWt3/Aw0LkE=; b=w24BqwOe4R+clUpChOjUpkEckkttxZxCd+uhej+PffXjDXbRg/6Ku0wjhX3eN9XE+O hSh2HrzRz1XJW9otaMpk4A4CwB+2IyOZhnyVN3F33CDU0OUYXXlkTlXl3SFcPr1c8IGo 5TTbQDYF1W9uwwRYQ71PekTplv2R8Jt5Gw4/YLcFiXoZh2xOQtd11A6Q+ax1rD57S18w xDxzZXJa842omYNsezywLahPH2EmCKTTt/hUUcxJ//3hFxWH6xw4Sf7/iPfeVtq4yfAA hSsbuEnG+2DNihk3g6/2lPs1ujnJi0lb2SWPA1r4Dgm5XTsz7DBgQhMzgzuw/nCgJa39 mcRQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 64-20020a620543000000b0063aed85c989si14467425pff.71.2023.04.18.18.06.53; Tue, 18 Apr 2023 18:07:26 -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 S231158AbjDSBAr (ORCPT + 99 others); Tue, 18 Apr 2023 21:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229879AbjDSBAq (ORCPT ); Tue, 18 Apr 2023 21:00:46 -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 BEBEDE71; Tue, 18 Apr 2023 18:00:44 -0700 (PDT) Received: from [0.0.0.0] (unknown [172.96.223.238]) by mail-m11875.qiye.163.com (Hmail) with ESMTPA id 9995B2803A9; Wed, 19 Apr 2023 09:00:34 +0800 (CST) Message-ID: <4831d6e8-72be-dd17-9c6c-6f37f58fa37c@sangfor.com.cn> Date: Wed, 19 Apr 2023 09:00:22 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH net 1/2] iavf: Fix use-after-free in free_netdev Content-Language: en-US To: Tony Nguyen , davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, intel-wired-lan@lists.osuosl.org Cc: jesse.brandeburg@intel.com, keescook@chromium.org, grzegorzx.szczurek@intel.com, mateusz.palczewski@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Donglin Peng , Huang Cun References: <20230408140030.5769-1-dinghui@sangfor.com.cn> <20230408140030.5769-2-dinghui@sangfor.com.cn> From: Ding Hui In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVkZQx5LVk5LH04eSUNJTBlDSlUTARMWGhIXJBQOD1 lXWRgSC1lBWUpMSVVCTVVJSUhVSUhDWVdZFhoPEhUdFFlBWU9LSFVKSktISkxVSktLVUtZBg++ X-HM-Tid: 0a879707273b2eb1kusn9995b2803a9 X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6N006Djo*Cj0SDhEdOBUqLwMp QgFPFENVSlVKTUNKQ01NS09JS0hKVTMWGhIXVR8SFRwTDhI7CBoVHB0UCVUYFBZVGBVFWVdZEgtZ QVlKTElVQk1VSUlIVUlIQ1lXWQgBWUFISktLNwY+ X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/4/19 0:50, Tony Nguyen wrote: > On 4/8/2023 7:00 AM, 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 lefted >> invalid pointers at dev->napi_list. >> >> If num_active_queues is changed to less than allocated q_vectors[] by >> by unexpected, when iavf_remove, we might see UAF in free_netdev like >> this: >> >> [ 4093.900222] >> ================================================================== >> [ 4093.900230] BUG: KASAN: use-after-free in free_netdev+0x308/0x390 >> [ 4093.900232] Read of size 8 at addr ffff88b4dc145640 by task >> test-iavf-1.sh/6699 > > ... > >> Fix it by letting netif_napi_del() match to netif_napi_add(). >> > > Should this have a Fixes:? > Yes, I searched the git log, and found that the mismatched usage was introduced since the beginning of i40evf_main.c, so I'll add Fixes: 5eae00c57f5e ("i40evf: main driver core") in v2. -- Thanks, - Ding Hui