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 5CE9541B362; Wed, 4 Feb 2026 14:42:52 +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=1770216172; cv=none; b=VpU46aXgZVickavB0EH+Fh3lu6BcygKDmciO2xRX94q1uBf2aoozRt5jzIKYT8AslxCQDxEiWqs8wgf1/L3JuJE4KutcoRStzXYfkHWqrgjiXSjfoqoNSsic7tkB5pwnG/2U9GsbMSDnji5To0ydArY6hJOwUOo0oCkXIlMJB/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770216172; c=relaxed/simple; bh=NMpy+/mULAwjIN2TQMmKXP2fxZG9S5I3fXkSbKEDEOQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=usidd14DXXdV5Atms0W867GNbDwctdQiM+tpNmUl9UxLjyujb0rVnBEWeRUWBgT9mB4N6yAnPipX3CF7lm+g7xgc87a1gsfrVlZqfQKyijPkE343EAEtsF0yUfJMDYq6aQermCshTs95zLvFXvRoKRGVeBL+sFYGX6lYxGQ40K8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ODVfUrNC; 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="ODVfUrNC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70F77C19425; Wed, 4 Feb 2026 14:42:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770216172; bh=NMpy+/mULAwjIN2TQMmKXP2fxZG9S5I3fXkSbKEDEOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ODVfUrNCs/VKNUg6zCGg9kk2y7CIUrG799TgVYE0Q01XfrF9gdwQXib2y66eT/9HT TdSxNIc6mbbpAM1DDKX/vrWzfpFCLSgI7t4BDzqxsEf/AllGVOIyO9Bu9jEkVE+Cyb AwK0J4PY9+7SjsuuHW6u2D/W83MUv7V0MTpllDe8= 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 5.10 001/161] pnfs/flexfiles: Fix memory leak in nfs4_ff_alloc_deviceid_node() Date: Wed, 4 Feb 2026 15:37:44 +0100 Message-ID: <20260204143851.812524975@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143851.755002596@linuxfoundation.org> References: <20260204143851.755002596@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 5.10-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 11777d33a85e8..35cac4d3f2e8a 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