Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5651874iog; Thu, 23 Jun 2022 02:36:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t18wruUSIdMvZyq1QdKrqsR0m24P5k29KMsNNV7IuMB83D+NhnI51rkhdEmWvf2Oexe/Fp X-Received: by 2002:a17:907:7f8e:b0:712:f503:1a56 with SMTP id qk14-20020a1709077f8e00b00712f5031a56mr7336840ejc.364.1655976975586; Thu, 23 Jun 2022 02:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655976975; cv=none; d=google.com; s=arc-20160816; b=lIWDnjkp/E3Q4v2YsnnPs4hQCV8yWmTDSv3p8z99vF8HRCnlvrQZhHZDX8F8BJ498N wS739cQz/7154E4myZwT7tp/iD3Qs8zIKJRUjMJNykby+f4hT/pLpZrinl9QgJIt98yZ Ol+eh9nQlvsHt015GGnuX6NV3ZtBPvc8NLMa4eeZxDapUvWyzhj/8r4y3NrJTsJjSzn/ aK731vCyPevBH3LNHDtP6e8kJ8rkTi9khilY44IYxAC+0E8YT/Ao1Knpq1tjFCQU21PF yOj83DfZ2rI4HHH7JpQedQw+v4KVBqoYr7ZJoRPt+tfD8UoMjGalcjxT8DjiBWSp+cyc FHmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-filter; bh=EKIPvALK1cXTsZBALd26oq28Q8z0/i5tehmQMg7z91A=; b=WOSEL0NeR56KDoXzLiZi0PYWA6e1gfSWEagw+3YRPvw2VjWlzq/vbJfGWRxK0prUqp 4kTj8qjzSi/ZDr3jKw6Rg3NmV+25eHIb43AvFD02bVHeKk5KAWyGCsfTwec79AokbGJi 0alOr+aQ84gDr7STBnpvI/oRskBf/11Bhiokoa3anH4Bqa6U+o7YubwtWc8gxLRQozq3 PWIyTHwl6nYj0z67/sT/gtrhgKjCQR65+46lOwIJNzGFpI99f6jCR15u9X+/YvoXpxgU kp5ShPFw1/yKh6Z8YsWoKThqLPPcyGPWqgN+/KcS96jg/A7u/iax01PokvgxHe8ElONC f1PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fr.zoreil.com header.s=v20220413 header.b=N5jVj9dE; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs23-20020a1709073e9700b00725eba201dbsi1572899ejc.341.2022.06.23.02.35.49; Thu, 23 Jun 2022 02:36:15 -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; dkim=pass header.i=@fr.zoreil.com header.s=v20220413 header.b=N5jVj9dE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230526AbiFWJ0y (ORCPT + 99 others); Thu, 23 Jun 2022 05:26:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230488AbiFWJ0x (ORCPT ); Thu, 23 Jun 2022 05:26:53 -0400 X-Greylist: delayed 220 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 23 Jun 2022 02:26:52 PDT Received: from violet.fr.zoreil.com (violet.fr.zoreil.com [IPv6:2001:4b98:dc0:41:216:3eff:fe56:8398]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC9AE43AEA; Thu, 23 Jun 2022 02:26:52 -0700 (PDT) Received: from violet.fr.zoreil.com ([127.0.0.1]) by violet.fr.zoreil.com (8.17.1/8.17.1) with ESMTP id 25N9MTVS377698; Thu, 23 Jun 2022 11:22:29 +0200 DKIM-Filter: OpenDKIM Filter v2.11.0 violet.fr.zoreil.com 25N9MTVS377698 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fr.zoreil.com; s=v20220413; t=1655976149; bh=EKIPvALK1cXTsZBALd26oq28Q8z0/i5tehmQMg7z91A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N5jVj9dEVpeCInEvy7kYFtMEp010qxdn7S55rFfgJuXbeqBEBhoEC+361TTbGFXSl P3maJiQmPi1ThXl3I2O5DKrXgcaD54A38QROMvnaZ1dLOBwc7h+oCmbLshWIfiFd0h ReGH0sSmblIlM1R4GT/szagjF0QRNyq/u80ttTzQ= Received: (from romieu@localhost) by violet.fr.zoreil.com (8.17.1/8.17.1/Submit) id 25N9MT45377697; Thu, 23 Jun 2022 11:22:29 +0200 Date: Thu, 23 Jun 2022 11:22:28 +0200 From: Francois Romieu To: Tong Zhang Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Arnd Bergmann , Jason Gunthorpe , Jeff Kirsher , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yilun Wu Subject: Re: [PATCH] epic100: fix use after free on rmmod Message-ID: References: <20220623074005.259309-1-ztong0001@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220623074005.259309-1-ztong0001@gmail.com> X-Organisation: Land of Sunshine Inc. X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Tong Zhang : > epic_close() calls epic_rx() and uses dma buffer, but in epic_remove_one() > we already freed the dma buffer. To fix this issue, reorder function calls > like in the .probe function. > > BUG: KASAN: use-after-free in epic_rx+0xa6/0x7e0 [epic100] > Call Trace: > epic_rx+0xa6/0x7e0 [epic100] > epic_close+0xec/0x2f0 [epic100] > unregister_netdev+0x18/0x20 > epic_remove_one+0xaa/0xf0 [epic100] > > Fixes: ae150435b59e ("smsc: Move the SMC (SMSC) drivers") > Reported-by: Yilun Wu > Signed-off-by: Tong Zhang The "Fixes:" tag is a bit misleading: this code path predates the move by several years. Ignoring pci_* vs dma_* API changes, this is pre-2005 material. Reviewed-by: Francois Romieu -- Ueimor