Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 3381435E1A9 for ; Thu, 2 Jul 2026 13:12:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782997944; cv=none; b=j9Pz5vKlphW6XnUKS+OZSLJOGwmxTm+SVPOw/2nLvW+1RSO9lkr8trNxsa0MjftqpZKfirVSFAmN/eqK6CeVqW2eZgakX7WiAQZ54vv/Ayc877Qgx2ASpZEHWspnpVbvHPFKOEnulo2nYxBwDyflNpYV4qepha1ndQWkD0hFRNk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782997944; c=relaxed/simple; bh=heRMfWo4pcbFs6JbV7x5P55pAzSMV6EPutGIdnvtbqM=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=a8JidhZlJQ2qdWRXN4+9kiGIYYM/MxxoRJCLMpnE7QQ0wE0rEhMl8HFm8owLuEVqd117QwYfkWT24fgS/JsuSLwMAYkBsYldGn+tBV0ek7RiUV9cw+eWIXCqzXw/hCC4QWfdBfEZzXf2SXGgxckcckC1Sxs+C7GHvRjnb8tv0tw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nfXrQyt8; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nfXrQyt8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CEC01F000E9; Thu, 2 Jul 2026 13:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1782997943; bh=EmCOPJ9dJAXqQiDwBKf7iebwOoJjjm5Mt9SrI2mMyPk=; h=Subject:To:Cc:From:Date; b=nfXrQyt8BkjtnMpTLrAycu5q2arihg1ud4VQIG/Xe0mFTQdORCDezZQztCcTUpgqG nTVyePtliGSV1YqXwH2tiWp3xnr9elxEReotAbotRhpYWt2JLr2atxYBIv0Vmb3u3d AVy++OcSirfaosVQRRen6aAbjsxpxh4sE1yZSH70= Subject: FAILED: patch "[PATCH] f2fs: fix listxattr handling of corrupted xattr entries" failed to apply to 6.18-stable tree To: iganschel@gmail.com,chao@kernel.org,jaegeuk@kernel.org Cc: From: Date: Thu, 02 Jul 2026 15:12:01 +0200 Message-ID: <2026070201-elevate-aide-0fef@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.18-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y git checkout FETCH_HEAD git cherry-pick -x 5ef5bc304f23c3fe255d4936472378dcb74d0e94 # git commit -s git send-email --to '' --in-reply-to '2026070201-elevate-aide-0fef@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 5ef5bc304f23c3fe255d4936472378dcb74d0e94 Mon Sep 17 00:00:00 2001 From: Keshav Verma Date: Mon, 22 Jun 2026 20:44:21 +0530 Subject: [PATCH] f2fs: fix listxattr handling of corrupted xattr entries Validate the xattr entry before reading its fields in f2fs_listxattr(). Return -EFSCORRUPTED when the entry is outside the valid xattr storage area instead of returning a successful partial result. Fixes: 688078e7f36c ("f2fs: fix to avoid memory leakage in f2fs_listxattr") Cc: stable@kernel.org Reviewed-by: Chao Yu Signed-off-by: Keshav Verma Signed-off-by: Jaegeuk Kim diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index 24cef7e1f56a..ed33e5110f2a 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -583,8 +583,6 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) size_t prefix_len; size_t size; - prefix = f2fs_xattr_prefix(entry->e_name_index, dentry); - if ((void *)(entry) + sizeof(__u32) > last_base_addr || (void *)XATTR_NEXT_ENTRY(entry) > last_base_addr) { f2fs_err(F2FS_I_SB(inode), "list inode (%llu) has corrupted xattr", @@ -594,9 +592,11 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) ERROR_CORRUPTED_XATTR); fserror_report_file_metadata(inode, -EFSCORRUPTED, GFP_NOFS); - break; + error = -EFSCORRUPTED; + goto cleanup; } + prefix = f2fs_xattr_prefix(entry->e_name_index, dentry); if (!prefix) continue;