From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF2D2D3B7E2 for ; Mon, 8 Dec 2025 17:06:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 5BAA183BFA; Mon, 8 Dec 2025 17:06:25 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 18xN4UJckU3K; Mon, 8 Dec 2025 17:06:23 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 5998D83BF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1765213583; bh=8s6SViZQ72dlw/cQCsIf2JyriIOxvr2obhp8T7chPs8=; h=Date:From:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=F16o691erWqiZiWwq4DM8TkVgZbfGqnkjBRqZsXB6zJ4vDILUvvTZLHlWMmV+O720 C5pa7rAZfe7GFJCyrSR1mOPiT+RiL/OT8qsCIYG6KMlO45L8rHO/+0+Jw3wcPseVUH f4ok1YCGdOYujzNFganN9EE4KCPstVYXbXy2YKeTE8cbJQt5efIFizrOUzqa0fCe9o g+swydQ8X2rGtOGU9fzGjxdPSCdP2pJeBOxJ7F2B6C6e7KRWwyOYc150Ck2yM3I6zM TsRMHSInhxrk9ZFTyJgnEHWMX/zHfIn0Hh7wpTuLFie5razpxtYukEB79guyaFkmdj FJMzoYBck1uJw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 5998D83BF6; Mon, 8 Dec 2025 17:06:23 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id E200C151 for ; Mon, 8 Dec 2025 17:06:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C820E60B4C for ; Mon, 8 Dec 2025 17:06:22 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Agl_hsYfo51A for ; Mon, 8 Dec 2025 17:06:22 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 3512A60B24 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3512A60B24 Received: from tor.source.kernel.org (tor.source.kernel.org [IPv6:2600:3c04:e001:324:0:1991:8:25]) by smtp3.osuosl.org (Postfix) with ESMTPS id 3512A60B24 for ; Mon, 8 Dec 2025 17:06:22 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 1CD4760133; Mon, 8 Dec 2025 17:06:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29736C4CEF1; Mon, 8 Dec 2025 17:06:16 +0000 (UTC) Date: Mon, 8 Dec 2025 17:06:14 +0000 From: Simon Horman To: Kohei Enju Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jedrzej Jagielski , Mateusz Polchlopek , Stefan Wegrzyn , kohei.enju@gmail.com Message-ID: References: <20251206155146.95857-1-enjuk@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251206155146.95857-1-enjuk@amazon.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765213579; bh=dWzchTxm0gXG4RlOi7Dhq5Q2vQ/4gedqC/TCr7AWiHk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qcPHdJUfQr7hJvkc5ghVSJDY6wK+5RSdqCPoSFVaLO8uJagVSyPL/nOHYwgABXAqc z0r9HW/cri9AFjN1p3jeR6ycPVt2MTqo4zbno+gOmqiDV+D9v8LfyWlUwCIpQY+EGX e3et9mw9g23EjlpkRLLB7ULidWgrxcrrAyxn+qDoIHxtgB9IugYO1xJAXa7hf6cXOP bbibPsqhsdCYJox/N2KFXlc6mKhqDuLcjKZBZN8Im3gbJ1FEUzQUSghzXweYW0jEMI QAiHeUi3uRzHman0AQNOxMXI5A4Sw8z2HMDdNVWh19PM6XoYa+CnEX610nHotcKvL3 JER78OJO/QTHw== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=qcPHdJUf Subject: Re: [Intel-wired-lan] [PATCH iwl-net v1] ixgbe: fix memory leaks in ixgbe_recovery_probe() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Sun, Dec 07, 2025 at 12:51:27AM +0900, Kohei Enju wrote: > ixgbe_recovery_probe() does not free the following resources in its > error path, unlike ixgbe_probe(): > - adapter->io_addr > - adapter->jump_tables[0] > - adapter->mac_table > - adapter->rss_key > - adapter->af_xdp_zc_qps > > The leaked MMIO region can be observed in /proc/vmallocinfo, and the > remaining leaks are reported by kmemleak. > > Free these allocations and unmap the MMIO region on failure to avoid the > leaks. > > Fixes: 29cb3b8d95c7 ("ixgbe: add E610 implementation of FW recovery mode") > Signed-off-by: Kohei Enju Hi, It seems that ixgbe_recovery_probe() is only called from ixgbe_probe(). And that ixgbe_probe() already has an unwind ladder for these resources. So I would suggest using that rather than replicating it in ixgbe_recovery_probe. That is, have ixgbe_probe() unwind when ixgbe_recovery_probe returns an error. Also, maybe I'm wrong, but it seems that hw->aci.lock is initialised more than once if ixgbe_recovery_probe() is called. ... From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 392C9EEBA for ; Mon, 8 Dec 2025 17:06:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765213580; cv=none; b=bYz7x/2ayAPFWsWADRxCmQ72SSZaeH82AL+t0hy3r0r1M0HaGc833Wq94nxTtvsrrWnQdoPZCeTyiVKlYDHL4XTHXGIXdkOfjtVOK3V08ScafSrWNKQ32WQTc8lCLxH/02w7fuMV4xv6xbPLOhx5gLjMkCw+tN2azQw8Y6wbTWQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765213580; c=relaxed/simple; bh=dWzchTxm0gXG4RlOi7Dhq5Q2vQ/4gedqC/TCr7AWiHk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UBAA5KKdQhHAotOCIePEbBe8gBReD5OiyvU61d/AN9VBYi2Co6WlolIRY2cRXGnhlbSGc/UEvbag9wGJT2sqmnKCc4W3X0kAFLd/LXigPGTRkhM7hGg/nxIo/+M4igBs/duf2SXxneTpkff7tPluqXthdI4ukQ1FbOeOlbVQ4oM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qcPHdJUf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qcPHdJUf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29736C4CEF1; Mon, 8 Dec 2025 17:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765213579; bh=dWzchTxm0gXG4RlOi7Dhq5Q2vQ/4gedqC/TCr7AWiHk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qcPHdJUfQr7hJvkc5ghVSJDY6wK+5RSdqCPoSFVaLO8uJagVSyPL/nOHYwgABXAqc z0r9HW/cri9AFjN1p3jeR6ycPVt2MTqo4zbno+gOmqiDV+D9v8LfyWlUwCIpQY+EGX e3et9mw9g23EjlpkRLLB7ULidWgrxcrrAyxn+qDoIHxtgB9IugYO1xJAXa7hf6cXOP bbibPsqhsdCYJox/N2KFXlc6mKhqDuLcjKZBZN8Im3gbJ1FEUzQUSghzXweYW0jEMI QAiHeUi3uRzHman0AQNOxMXI5A4Sw8z2HMDdNVWh19PM6XoYa+CnEX610nHotcKvL3 JER78OJO/QTHw== Date: Mon, 8 Dec 2025 17:06:14 +0000 From: Simon Horman To: Kohei Enju Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jedrzej Jagielski , Mateusz Polchlopek , Stefan Wegrzyn , kohei.enju@gmail.com Subject: Re: [PATCH iwl-net v1] ixgbe: fix memory leaks in ixgbe_recovery_probe() Message-ID: References: <20251206155146.95857-1-enjuk@amazon.com> Precedence: bulk X-Mailing-List: netdev@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: <20251206155146.95857-1-enjuk@amazon.com> On Sun, Dec 07, 2025 at 12:51:27AM +0900, Kohei Enju wrote: > ixgbe_recovery_probe() does not free the following resources in its > error path, unlike ixgbe_probe(): > - adapter->io_addr > - adapter->jump_tables[0] > - adapter->mac_table > - adapter->rss_key > - adapter->af_xdp_zc_qps > > The leaked MMIO region can be observed in /proc/vmallocinfo, and the > remaining leaks are reported by kmemleak. > > Free these allocations and unmap the MMIO region on failure to avoid the > leaks. > > Fixes: 29cb3b8d95c7 ("ixgbe: add E610 implementation of FW recovery mode") > Signed-off-by: Kohei Enju Hi, It seems that ixgbe_recovery_probe() is only called from ixgbe_probe(). And that ixgbe_probe() already has an unwind ladder for these resources. So I would suggest using that rather than replicating it in ixgbe_recovery_probe. That is, have ixgbe_probe() unwind when ixgbe_recovery_probe returns an error. Also, maybe I'm wrong, but it seems that hw->aci.lock is initialised more than once if ixgbe_recovery_probe() is called. ...