Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp2089860lqg; Mon, 4 Mar 2024 12:29:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWTHNAumXtbJu7KrjUXmubRIOsiyNt9qhX0c/phwFMrz5rrTeR/DIbxmsfdys2sz02JrW/p7zNNCE6IIXPmmwhaQzBp86RM8Fdt3omLnw== X-Google-Smtp-Source: AGHT+IETkmlP+ff/QMIj4XAaxpkQoTpEhgTbBG9DXeWJdkpqwgXvnahuOIq+wLFUma8LBpe930Z4 X-Received: by 2002:a17:902:c952:b0:1dc:a84b:e93b with SMTP id i18-20020a170902c95200b001dca84be93bmr11211971pla.4.1709584160847; Mon, 04 Mar 2024 12:29:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709584160; cv=pass; d=google.com; s=arc-20160816; b=BAdNIrfn/8W5EEfNibDpuaZlm+ZX7grgCEfwAI9eaV14PbEkeD5aA36xjyE8Sp2mjS 6Y0cfbH+PPp6TIB8uG5oA/yI9F4vcsEowHRA8NI4/jHZLjcqkZVQUK9qd9M+T1QTGdJQ AjElS43DK1UKih9WO8hdxtja+cZ4RiwrBB7AcY//F+VXF7vS6adkiitkcKMZEMQ45ta0 /Wtr4ZZhmOHU4H6aK0L5rHh97F0RI3JWSgZkTRyzyuu2HlYijaRibK8jFjLeE0uT0iMD +PSdhQ+LHdJksSWmxu8vrJVPxZ9Mbip43NTfP26r7ewGcxnWWzw29vJ6VPGGBxOPGA+O m2hA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=DOo839mPdY9UDs30ip9szN5AzGukhwe6Ypv0TWThp7k=; fh=p2Oaibl1UGBWIve2mevvQYHQPs3aH0zwl7hiCY1DXnk=; b=P1QYUPN2doq8mfVB2d4kOJcbLvtS4smegMogesgBIXYGfQf20hrVYWplaM7arPTYLe 9de2FEC8W+Kn+/BBmS3+bzr1bcAvM/RcYiJhL+jNi7laWDu0tWBXT5aMNhnbH/hKfLBj BiWGth0GeCWGzfRF3LD3nUYCmUn9PdTh9ourG5q0T9713oYTlAGPQbpwlxSnElJewJGP ELtt6YybXkvKWKgoU8ggY1s+sjJo3x6NzwnLiRhBmBov7/+/B2xEngac+PpKSR690Po/ ARP3CwSfd4TELAPhhf5lbuN8eDuaBmHTa+RzjfDafw0WadC+7jWbiDEt3G6MUuTNmu7r uHsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-91236-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91236-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p2-20020a170902e74200b001da1b31fc38si8985411plf.497.2024.03.04.12.29.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 12:29:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91236-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-91236-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91236-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7B3E8281530 for ; Mon, 4 Mar 2024 20:27:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EF717B3FD; Mon, 4 Mar 2024 20:26:39 +0000 (UTC) Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29D454AEF9; Mon, 4 Mar 2024 20:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709583998; cv=none; b=pP/K3izD+KyX0rOuFsfoOdUaKS3YlkDMdymEDKw8TWn7rtyK2a7Q/KGwP7SaiGXqkM9QM17P9S6Apl1odr+3/zFi3ZsqqCrIE4m4QjyEN/v9cNJ63gAbVio1fYJ693TIFECYVM9QUagNZ4vBCMxRDpiwYr/35a5nkRqC+L4HgXc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709583998; c=relaxed/simple; bh=WKR5soPbdwv5SITAS4Ia+IV6JgbXybFywnXAPKGhW0E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZfnkMI64qo11kRev8urP05ptaUos0ubOzuoU5F+NwQ0HXQaEaolQiwHJ7lIYqWt5fyyBp4PE96lgtUEBCFgZvWb3XIAiQu7COPD1pi0Qwv0rk8p2ZO+K0Rqu8VLpFXgA+GdHwqBycdbpbuvjsFewhRU2XBLE0l832TrJyDSKURc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a3ddc13bbb3so987154766b.0; Mon, 04 Mar 2024 12:26:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709583995; x=1710188795; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DOo839mPdY9UDs30ip9szN5AzGukhwe6Ypv0TWThp7k=; b=E44KnzlOkAwC0BLvgNBpgSv0RRM2NuOLSmadcIUdPD7fz2DVY4/J/qzYGqLCnRZ/Xf wKaKtd/iVtoC5mD7qLHIwFi1nE9LCorDWDsdBPzHFZgO9KgRqnfD5rXtdpKMu4Pye00E lccUg5FIjm9axo7F+EREPHv3WUIPYDT4tnNFG+ED9kubBSZJtF1331DVNsn1eZjY7rKo /a+S95bniI/fBkDhG6x9T5QacJcJYCjiUTIAN/go3LEGCKwxvuLzC9Gej1kqcsjk32Nf MKsQUZHEZNhctAcRrCRdo1HBPDPg0cpZrZBiREDFMxBFQno/HgkTJv2HrulR4QxgxRO8 6oWw== X-Forwarded-Encrypted: i=1; AJvYcCWnoTIy0LiIv9tkXOqrfvAGsPHlhfR7BMzJo+fPvRuTptGHx4rxGBiexkKGGZSLMhIQhdswKYrPv0jHXkpv7HOIwfp+wbD0cGxgl1W8gPjU+RPWjbNwaMlOu6gNT4tzimGU/Dai X-Gm-Message-State: AOJu0Ywo1xU09oueEE0br5c7ZMkqFL/jZrC9FpBoDdei774Bp9Jouw/O SWB/RFU3EkmEiYuiKIz0rvBn2XWIQUPccw+5Ml7HC/w8g8cU29fx X-Received: by 2002:a17:906:595a:b0:a45:2678:ae55 with SMTP id g26-20020a170906595a00b00a452678ae55mr595894ejr.13.1709583995469; Mon, 04 Mar 2024 12:26:35 -0800 (PST) Received: from gmail.com (fwdproxy-lla-119.fbsv.net. [2a03:2880:30ff:77::face:b00c]) by smtp.gmail.com with ESMTPSA id h20-20020a170906591400b00a3d5efc65e0sm5236070ejq.91.2024.03.04.12.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 12:26:35 -0800 (PST) Date: Mon, 4 Mar 2024 12:26:32 -0800 From: Breno Leitao To: hyper Cc: shannon.nelson@amd.com, brett.creeley@amd.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jitxie@tencent.com, huntazhang@tencent.com Subject: Re: [PATCH net V2] net: pds_core: Fix possible double free in error handling path Message-ID: References: <333dca5e-fae7-4684-afa8-10b8fdd48bf6@amd.com> <20240303084954.14498-1-hyperlyzcs@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240303084954.14498-1-hyperlyzcs@gmail.com> On Sun, Mar 03, 2024 at 04:49:54PM +0800, hyper wrote: > When auxiliary_device_add() returns error and then calls > auxiliary_device_uninit(), Callback function pdsc_auxbus_dev_release > calls kfree(padev) to free memory. We shouldn't call kfree(padev) > again in the error handling path. > > Fix this by cleaning up the redundant kfree() and putting > the error handling back to where the errors happened. > > Fixes: 4569cce43bc6 ("pds_core: add auxiliary_bus devices") > Signed-off-by: hyper I liked this v2 better. Reviewed-by: Breno Leitao