Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp687807iog; Fri, 24 Jun 2022 11:45:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sxnxdT7NHQ7MoV0HYwdkR4whrVwXd9utBz+M/q7i+vnt5HpMalwTeo56jsE1NORpLAdl/n X-Received: by 2002:a63:140e:0:b0:408:a923:1a81 with SMTP id u14-20020a63140e000000b00408a9231a81mr246376pgl.358.1656096352958; Fri, 24 Jun 2022 11:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656096352; cv=none; d=google.com; s=arc-20160816; b=iHTY4LMHwcPKH5PZuVLjtVwwppdGSI7/ugDRA6uabiNnOozcTJAy/zztLQx8IFoV7b 9Gjm00fYu0iBpvtwj4+w1FlaWa8TYqeEDnJwBi/dZFEVZU/hOCl55hLkiWCkremUmcy1 5lrRcaI1mySfqRkkC7BW0z5l6Y34sQLvs3sizNagUxcr/xGQ5Vzk+/e6jUk+jZHHnbIh RZjFyz+yTj1eo5NPX68ccUWEu2avxbE0J5vChoEQCqb5+9WQxXuIzHxlHxt2s5fuHpZi iGYG8lqYSkYrGvPn1sK/ebstHO3Xe/y4OEI4H5aaXC42kf90JVVAxoVJofuE2oVGkECa Buhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=xXO4ZL3QhnIWWuiBo4pWvR3sBUaKKRnOBnLtAt3YHJQ=; b=s4giR9B8M/La5+qWTmH3zQjdaKqwECZidHliXJGovKfywpGsCmaK5oFEnJWRLxfCow sX+CP3b1mJzFLpZMkbKU7qzP7M8skLl/49R6wV0pZnJl7r0O8x3X4kwx/iltGnnkNlD0 UOWEuNIIm3ibkkWBX20D5MKhgsV+waY3wTXX15GRflrncAzIPlWg6ikfe1kULl+z7v6M p8mNypABT7AyE5C6UvnSfjcHw0LeCJorHVeWvo3W4J6tPnkuXLb0v0TpiUjclVJIqdZP Rgf8Vvlvf5pismpnwvfxNPGBwjMovdOVRBf+RCxRgC//VtCWXAk7WZ8yJAE0PU1mUyiL RLMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q3B77Hsu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ob1-20020a17090b390100b001ed05bf19basi8011731pjb.67.2022.06.24.11.45.35; Fri, 24 Jun 2022 11:45:52 -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=@kernel.org header.s=k20201202 header.b=q3B77Hsu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230010AbiFXSli (ORCPT + 99 others); Fri, 24 Jun 2022 14:41:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231791AbiFXSle (ORCPT ); Fri, 24 Jun 2022 14:41:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E20718124A; Fri, 24 Jun 2022 11:41:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 438A4B82B93; Fri, 24 Jun 2022 18:41:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89421C34114; Fri, 24 Jun 2022 18:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656096091; bh=LLrh7VajFjPgitdpBx89svk5eDbdeDVcrRqjN+kDTDU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=q3B77Hsu8ocmQuG9T1pjrdkUwWevlJCUG7iQDR6TqJAUsrAbCNkilN7IrUvH1NK+z /5J54VlciMTaMr8euisYbiIxTKYvhmjluVkInxyu4lnvxq//ZNSAsCSg/lFS/iPt01 TTaLvL6xyyEp2cWxtcN5221lca2zKbMoM12UIhe1kHzFARnMGk61i5B1dQged6eFo9 0iTNBagNiaePhn12/PADqa8PJrXmDGlWWFWulv8DHsgO4k/trm/zmVWv/pjBdUlMfs RmE11DpZac+DZlZJabuS5j1vIzTSUAVj2SqcDdNTV2lREgMLvZrOaj2NiTFfjHadrK Dt5GgW0TccpvA== Date: Fri, 24 Jun 2022 11:41:21 -0700 From: Jakub Kicinski To: Francois Romieu Cc: Tong Zhang , "David S. Miller" , Eric Dumazet , 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: <20220624114121.2c95c3aa@kernel.org> In-Reply-To: References: <20220623074005.259309-1-ztong0001@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 On Thu, 23 Jun 2022 11:22:28 +0200 Francois Romieu wrote: > 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. Yeah, please find the correct Fixes tag. > Reviewed-by: Francois Romieu Keep Francois' tag when reposting.