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 BD67E36D512; Wed, 28 Jan 2026 15:28:25 +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=1769614105; cv=none; b=lBjoh0uIWpDy1BPK/kQJrhZolY15YNT2PZNNLHlLF+CiX5ATw2grGFJEERw1tPwanHYfBLu4uB+9MUNgGDxVMrKbJ30/wA012oeAv/T6ZcXWwBIsFuRUOAOqCj2bqrcWLu7QMkD0uGNRXjf4NqG/G9u19xcUmk5Eu1yC/j4yJms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769614105; c=relaxed/simple; bh=s4a8b86oa/sY3qH0OSOF8mZNyBMHW0lNC6qcLetYL04=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gET5PBR7W7p/wUv8jJxAXBJV9W7M9VSv3r9ANtWUGLw7TleCyWOpJLsA1KxBGCyRv5XvBbUZmkbwiI7dPBE4UL9sbqpRM5eahrcRwfuOURrWYw4S3yKSiANTIuBks216wGty1Q44Htqf2Gdd93iZg5vyPo/knRLQ7U1oY3dMpJE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=EQQXbGFL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="EQQXbGFL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3131CC4CEF7; Wed, 28 Jan 2026 15:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1769614105; bh=s4a8b86oa/sY3qH0OSOF8mZNyBMHW0lNC6qcLetYL04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQQXbGFLcM3stTexHzi9E8VJZDXSnOHrlBK9PuCu7iQqJttG87xIhbLXW+EjoyJ9k O1IMdzz59mwZzhWOor7HW4cS6PHHQOAV9zF7Vkzny0ffNwM7QJIVn3BlE2Qdkv89Wv wKfm7GmcK4P6LpUck9zl5PoT+a1iGnRj/2LmPlH0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zilin Guan , Trond Myklebust , Sasha Levin Subject: [PATCH 6.6 006/254] pnfs/flexfiles: Fix memory leak in nfs4_ff_alloc_deviceid_node() Date: Wed, 28 Jan 2026 16:19:42 +0100 Message-ID: <20260128145344.934929355@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260128145344.698118637@linuxfoundation.org> References: <20260128145344.698118637@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zilin Guan [ Upstream commit 0c728083654f0066f5e10a1d2b0bd0907af19a58 ] In nfs4_ff_alloc_deviceid_node(), if the allocation for ds_versions fails, the function jumps to the out_scratch label without freeing the already allocated dsaddrs list, leading to a memory leak. Fix this by jumping to the out_err_drain_dsaddrs label, which properly frees the dsaddrs list before cleaning up other resources. Fixes: d67ae825a59d6 ("pnfs/flexfiles: Add the FlexFile Layout Driver") Signed-off-by: Zilin Guan Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c index 95d5dca671456..ed18e9e87c25f 100644 --- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c +++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c @@ -103,7 +103,7 @@ nfs4_ff_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev, sizeof(struct nfs4_ff_ds_version), gfp_flags); if (!ds_versions) - goto out_scratch; + goto out_err_drain_dsaddrs; for (i = 0; i < version_count; i++) { /* 20 = version(4) + minor_version(4) + rsize(4) + wsize(4) + -- 2.51.0