Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp463884lqs; Tue, 5 Mar 2024 07:10:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW7sXk6jePEE9V2CpP8zDygnJOzAUpr+sBF9eaQnVo24i5v20ryOKs9gyqhNxEGHXo9tfsvWNNWh1DMkfl+29/8HGQ/SGfHZtoGfbDR0Q== X-Google-Smtp-Source: AGHT+IHYN6F5Uh9SE0lPRz/CnzLlxE6RhwuUlqEAQ5RBl+QKJZI8uJQd4hxXPduIVf2vl6Nyp/q7 X-Received: by 2002:a17:903:228f:b0:1dc:b691:85f4 with SMTP id b15-20020a170903228f00b001dcb69185f4mr2716671plh.16.1709651428143; Tue, 05 Mar 2024 07:10:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709651428; cv=pass; d=google.com; s=arc-20160816; b=QdjQcaZRFzuLE1/Hu814ZIBfjbm1B/XkQoTLYwLllWfPHAZazuTQwmsL5pxpMW6KpY /+rjokHph6/LVcWA0YzYj1hdf/lCm9XWpctUa2hTMKTqS/QTkg5FUfyL7cvf317fU6oK 8C2p46S2DvIu6IDN/xY9FR4a9F0UtrXxkqFpqXQKvExvyBCvGD/Wnyv5ByvPlGejlmGL iH7VPT3cO5Ah1SVDj3QAy1HA/zS7g76GLA1bQ1NufSriJo0KPYHB4iXZi2pBg4+ywOFZ hWADe/rUo/wDVNBTbWTd5LY598xWZFb4v6/Zk3c1nDa1heV5GtHdqnXfNXb5F7QT1W7A 0exQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:autocrypt:references :in-reply-to:date:cc:to:from:subject:message-id:dkim-signature; bh=rQ6RlTT0Uwq7mRxtdBk3ry0dIbPCmSAeuKHUDvJUyyg=; fh=YvmWt0XW3RtmywSkWsrw7YpuM0oGv35vUFCB8x8XHcw=; b=aQ3bD/hFhpnYA8DBIE97G8Whcfa8R22UOwvaUcSwwzTWUnZLSn464TCe0JOcCiPFCz qQ/e2hKG5i2+DhuE5iz13d8n2hkdpqr0MVaB/lIphT2JsYS+lfjvQ8Ux6c79GXN+5Qot /oXd00tMaCF2Cej69GgTM48q23Be837YOUu6Je1SvmtAwdchCVSwT7EU0UiPmZ1+rQqg IwzBw0T/swq7cY6uf116MYkdrl0W2npYp06eASud9Px4NxpvWC2IQ9DHiqH/jzRSLJvu 8usyGgOsJRFErO4usVF0GGPBTF4orRhKRr1ZAwAPisJZQM0kYUfUjtZSlkshj27cQUbG b4ng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eFfvNZDT; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-92563-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92563-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i13-20020a170902cf0d00b001dcbb569d36si10454933plg.129.2024.03.05.07.10.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 07:10:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92563-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eFfvNZDT; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-92563-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92563-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 6FB61B252AC for ; Tue, 5 Mar 2024 14:59:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46418126F31; Tue, 5 Mar 2024 14:58:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eFfvNZDT" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92A2285C52 for ; Tue, 5 Mar 2024 14:58:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709650725; cv=none; b=RGDLFAQI5zkG5JThTNKPqYHiT2wUBeehr0+7TYgh+tCO8kAHMFMIfqM8KgC0jIYhOJ00Xxc3m+aY4d5OjQDXU/szYCr1lHKc7f4XaE/2LAX57Px15PeJvwrmR7cn3DGS8fDZfJ5PY/ZwghiVoK9RzaZ7/u+HQR2O7KB1KxZu5bo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709650725; c=relaxed/simple; bh=rQ6RlTT0Uwq7mRxtdBk3ry0dIbPCmSAeuKHUDvJUyyg=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=n38dQBzwWpZRCvJzJ/t7ndHKjTCJJSsYtdyYvUkw8v/HaRz6UFlELADNkaxvhL7wnGOFeWjXO8mGjilvZ+oYG/qmcZXmzBCwN23msdFOlENl9wXnz6ya5vR/SxGIb7RwXs7gBhCFCIGWZs9E5dVqcZ5Zv64VJrsVPdkWbmoxSF0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=eFfvNZDT; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709650722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=rQ6RlTT0Uwq7mRxtdBk3ry0dIbPCmSAeuKHUDvJUyyg=; b=eFfvNZDTKdog65SzlOZyLEFUU8l3ho63GhNYc1QsPRY6c9Ri3usUhI3RPkh+Hzbc7TfUjv /KbnqBlXBZzCf8grfaipe5sotXC/t4tsNbMGoihzRlA+qWTYFCHJxz6RFy8zhe5/Q98NbN YJJtVXnkC5TtKUbnStay/lnj64ANI8o= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-39-HFD_5JH0PeyoVcAc6tSV0A-1; Tue, 05 Mar 2024 09:58:40 -0500 X-MC-Unique: HFD_5JH0PeyoVcAc6tSV0A-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-33d8b2a57fdso705286f8f.1 for ; Tue, 05 Mar 2024 06:58:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709650719; x=1710255519; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rQ6RlTT0Uwq7mRxtdBk3ry0dIbPCmSAeuKHUDvJUyyg=; b=d7Wev+U2DkkGhezNLgFUpMnr40whEzJdSjn7e/QvJoQqZ3AzcqWvsCsjWRbRByX8Xl e0DZWfyp3Q5As3b3H4rxANL0tQi7kBQk7eyhyLP6AU8T6W38/AcjYKbWGD0wnU7kIIvU 7klMeYvAGg4XX1nviSsqbhWDx+5Aot5Gv8Ro+ebkhAfyQOvp0z5BfYBVRQlfBjfPayV0 4vMJK57CKEI7GrHmAYUr/6EBRqKMmUNb5X6tJ2zWBW8ZWyGJwlHTTATIsdG2bCJdTV6A vs3Rwp9thRiHidA6afe30w28rV/M8wRe6yMmq5je7R3ykzIIPLGCq+tpjvJ8Nh4M3Ga+ Q6Fw== X-Forwarded-Encrypted: i=1; AJvYcCWz9cRIu6iaZF256ienNxsnWdylqGVUwUS79crNcze2wzZkg0KiHayD0czCGZ7bX0mWjtPuTd3xEO2evlmbjjUMuKpz5RCtD9EanE2B X-Gm-Message-State: AOJu0YyoLGCH+jes8YD3oHq3jl+tCaE3lU2sIfGkXO30VCMKWnwoXtnp pmWeRkdclrlqPoDf6I19fFW91YPuZ+phNhLsT51uwo4IcKCtQ4yT9CL8o+B07GIARB+IsQySEMh siQ+HyA2C0E3FlUgisRp7waC/azID4CFnFLDHVOQAV9R1NghYdOO1VXLursbHSQ== X-Received: by 2002:adf:f1cf:0:b0:33d:9ee1:48db with SMTP id z15-20020adff1cf000000b0033d9ee148dbmr368354wro.2.1709650719360; Tue, 05 Mar 2024 06:58:39 -0800 (PST) X-Received: by 2002:adf:f1cf:0:b0:33d:9ee1:48db with SMTP id z15-20020adff1cf000000b0033d9ee148dbmr368336wro.2.1709650718959; Tue, 05 Mar 2024 06:58:38 -0800 (PST) Received: from gerbillo.redhat.com (146-241-235-19.dyn.eolo.it. [146.241.235.19]) by smtp.gmail.com with ESMTPSA id d15-20020a5d644f000000b0033e052be14fsm15093216wrw.98.2024.03.05.06.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 06:58:38 -0800 (PST) Message-ID: <9c4da99a83bceb4680aac9588151cc8190ff07e0.camel@redhat.com> Subject: Re: [PATCH net V2] net: pds_core: Fix possible double free in error handling path From: Paolo Abeni To: hyper , shannon.nelson@amd.com, brett.creeley@amd.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jitxie@tencent.com, huntazhang@tencent.com Date: Tue, 05 Mar 2024 15:58:37 +0100 In-Reply-To: <20240303084954.14498-1-hyperlyzcs@gmail.com> References: <333dca5e-fae7-4684-afa8-10b8fdd48bf6@amd.com> <20240303084954.14498-1-hyperlyzcs@gmail.com> Autocrypt: addr=pabeni@redhat.com; prefer-encrypt=mutual; keydata=mQINBGISiDUBEAC5uMdJicjm3ZlWQJG4u2EU1EhWUSx8IZLUTmEE8zmjPJFSYDcjtfGcbzLPb63BvX7FADmTOkO7gwtDgm501XnQaZgBUnCOUT8qv5MkKsFH20h1XJyqjPeGM55YFAXc+a4WD0YyO5M0+KhDeRLoildeRna1ey944VlZ6Inf67zMYw9vfE5XozBtytFIrRyGEWkQwkjaYhr1cGM8ia24QQVQid3P7SPkR78kJmrT32sGk+TdR4YnZzBvVaojX4AroZrrAQVdOLQWR+w4w1mONfJvahNdjq73tKv51nIpu4SAC1Zmnm3x4u9r22mbMDr0uWqDqwhsvkanYmn4umDKc1ZkBnDIbbumd40x9CKgG6ogVlLYeJa9WyfVMOHDF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lRVY7soqEYXylyCOXr5516upH8vVBmqweCIxXSWqPAhQq8d3hB/Ww2A0H0PBTN1REVw8pRLNApEA7C2nX6RW0XmA53PIQvAP0EAakWsqHoKZ5WdpeOcH9iVlUQhRgemQSkhfNaP9LqR1XKujlTuUTpoyT3xwAzkmSxN1nABoutHEO/N87fpIbpbZaIdinF7b9srwUvDOKsywfs5HMiUZhLKoZzCcU/AEFjQsPTATACGsWf3JYPnWxL9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (3.50.4-1.fc39) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Sun, 2024-03-03 at 16:49 +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. >=20 > Fix this by cleaning up the redundant kfree() and putting > the error handling back to where the errors happened. >=20 > Fixes: 4569cce43bc6 ("pds_core: add auxiliary_bus devices") > Signed-off-by: hyper Note that submitters are required to use real identity: https://elixir.bootlin.com/linux/v6.8-rc7/source/Documentation/process/subm= itting-patches.rst#L438 Could you please repost avoiding the nick name? You can retain the already collected acks. Thanks, Paolo