Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1822861rwl; Sat, 8 Apr 2023 02:34:59 -0700 (PDT) X-Google-Smtp-Source: AKy350aaBSqpf2jLMfnYl/+0BvQAc1XLJGzEjRLTGt4yiUiR5/05avBULXku/3NQ9e2BB0H3w7rH X-Received: by 2002:a17:903:41d0:b0:19c:b7da:fbdf with SMTP id u16-20020a17090341d000b0019cb7dafbdfmr8030482ple.26.1680946499242; Sat, 08 Apr 2023 02:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680946499; cv=none; d=google.com; s=arc-20160816; b=nrdiVYBC6d0YQWPTMcDqiWXrrTpZCHv5T6IcpDLZhpl9W7clhi2QkHeGkSUBywiX5a 0r3uwfudZk+d/lhxkw2Y1C/SlzaOy6mdPFPVMU9OJnzgnwezdIUUD1Oe2OwlA6mXkIRC 2zqldAk7nJhtrzu5wiFc5SGDym4gMGmm9u2PWQz/BcGPSiw/zUcqPUFwUyWslQwBbNBH Aqs/JH7M+m1XdoIm2XNZbaB8v+CQd1Ro4FFE0ClCjZo20kcFAOcHzDSG7ZTw+NFVx3hK cQJYpLjWvKtLXwrMaP3jIpWDH+NbmJ8QwFMXwN7fH/5IRPi106jwANvfVmxQ58k/sjbj uBGA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NMeMxaD4m+KylrkhWYQ+htT6phMUMSTHkCE92JtfNdU=; b=RMNfa8+WUumO8ezV3FQkFmNWoQa5Dls9x27w/LH1QVA9TMDcvvp2ps3OsUrw2FBFM7 cMvzHK9cJxou97npYXeKrkI6G3gX58rZEQ0BNOwhrTd8CxMFMh1ag0mSy4lCJY3S6Z3H ar+NlYhX568Z3onGcxNanWPxT+74TaZ15XSk0vISNK1UyNeJ1Sz32s7T7i4fj+vqTB43 AxmpnjUpxGu6IzbfmPCOob9LXA4X0P+BHzYuhLDFYFI6D7kMnFwjqJYlf0C/dtJitvrJ Vz/7UmZHjlHYVz7KD/2byNRDeE7weZSDC2UZNpomr1VOQ4KupARlVu3jP9T4HNtLhsgl VRmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vf5EMTu4; 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 d4-20020a170902b70400b001960fd737b6si5769184pls.330.2023.04.08.02.34.47; Sat, 08 Apr 2023 02:34:59 -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=Vf5EMTu4; 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 S229760AbjDHJaW (ORCPT + 99 others); Sat, 8 Apr 2023 05:30:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjDHJaV (ORCPT ); Sat, 8 Apr 2023 05:30:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E141C140; Sat, 8 Apr 2023 02:30:20 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 0F71360C61; Sat, 8 Apr 2023 09:30:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFDD7C433EF; Sat, 8 Apr 2023 09:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680946219; bh=QPaxSX3lE++4lFklDls2/M5OGki5DbVvgLfnx2VYHZ4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Vf5EMTu4n18afkrtUpoa8kDZL9uqbLygjX+jByM4VolzMAFO0RUtP+wH5GqwoYB46 Ax3tHUOUV8b4nv7QvwUgGYGqc05yrkQcOMhU1zdsZluKmxIGk0VWp4mmujnMBWYVwX h4NwJewMtcBc0K+h3R8wIKhV4LLfnIoMTX5SWs6qpAubOI8ggycRWsKCEjRChgYy5g Gg9UihgzwaCNzqS9isB+iUKPoUcpKrv+zMVMf3bWX1IKeFqxv8do7Mv3PdThQOk2OK 2gbqhpjpGhqjg8wyLT009y7BrSOA6lVJrmTf7fcnUk/+Outh2KfurVNBdyhWpIpBHM 1EjTILes5DRCg== Date: Sat, 8 Apr 2023 15:00:11 +0530 From: Manivannan Sadhasivam To: Miaoqian Lin Cc: Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Yoshihiro Shimoda , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: endpoint: Fix potential double free in __pci_epc_create Message-ID: <20230408093011.GD11124@thinkpad> References: <20221220045930.1106921-1-linmq006@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221220045930.1106921-1-linmq006@gmail.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 Tue, Dec 20, 2022 at 08:59:29AM +0400, Miaoqian Lin wrote: > When all references are dropped, callback function pci_epc_release() > for put_device() already call kfree(epc) to release memory. > Remove abundant kfree to fix double free. > > Fixes: 7711cbb4862a ("PCI: endpoint: Fix WARN() when an endpoint driver is removed") > Signed-off-by: Miaoqian Lin Reviewed-by: Manivannan Sadhasivam - Mani > --- > drivers/pci/endpoint/pci-epc-core.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c > index 2542196e8c3d..7dc640c99d9a 100644 > --- a/drivers/pci/endpoint/pci-epc-core.c > +++ b/drivers/pci/endpoint/pci-epc-core.c > @@ -800,8 +800,6 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops, > > put_dev: > put_device(&epc->dev); > - kfree(epc); > - > err_ret: > return ERR_PTR(ret); > } > -- > 2.25.1 > -- மணிவண்ணன் சதாசிவம்