From mboxrd@z Thu Jan 1 00:00:00 1970 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 75F3612B94 for ; Mon, 22 Jun 2026 01:23:45 +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=1782091426; cv=none; b=st0Jaewh2aQ3qZa/QkUiBFu8s4bH9Uw7oKIXJt8FoGXg1+DAZhUVuUhhURMWnQF/jG35Gvk5JgIXJUNq2p/lrNkqer2KXya2E2m0VlThPl0+NTghdS6UMsvF/xOsfFtG8hNLqLdqeG1yRjYCIIDxVqnvCjw7VUpI40e7RQLnoa0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782091426; c=relaxed/simple; bh=sQnU5iWpgz6qYRo+rm+jp8PjXh8H+DIPlzlOXSQajKk=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=jad8/4wqQ6KcgQFyFa3QeVuqRLXV1Go6cwn6z5f0tYYhzdcEiDcbQKIhbvgIQGiaEHanG4qSLzmdouixJEWSczjix/tm+WP4sACyXW+VW83VYJBmR4p2hBE/iQs9Oh119jspk/XxEN7sQ+tXPA2iLvV/hS+Twjz0ZAbl/yC1THs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bIzh/VTM; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bIzh/VTM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2A2C1F000E9; Mon, 22 Jun 2026 01:23:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782091425; bh=PD6FDPyWUVvXtNbAeYAkqONlzLQlXrWeVKkkNyoNXi8=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=bIzh/VTMdXrki3KXykUFpwu4w9ZzJUwepbQHtWYZZ67ZXv4w/VELKtSrBrRQKehaz uZyoZed+ee/GadRZWGh8hAhmPI6+juk7MuRmqGu15gODMATPdjVhrjDkpUrfRp6rb9 GbhSUPl/PodV+sGTeXnP0jh52AU8qggSO9jeoyUPwVZGjVnTDLY9MV9nBMhpuoLh0O mErN0FEqa6Y/B+BhlMXgSb+sIfTEDjcSxD6DEZkgCaUv60gG/O35eVEGv6qtOrlB98 3PrYYCnWajdUqtR9MYUavt6uNGTmTh/VqsfmeUtKtHHRekJ8thDIhxkCgGDXvUFQ+I qcx0b96Fchs5w== Message-ID: Date: Mon, 22 Jun 2026 09:23:41 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH] f2fs: fix listxattr handling of corrupted xattr entries To: Keshav Verma , jaegeuk@kernel.org References: <20260618200105.3551-1-iganschel@gmail.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20260618200105.3551-1-iganschel@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/19/26 04:01, Keshav Verma wrote: > 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 line and Cc: stable@kernel.org > Signed-off-by: Keshav Verma Reviewed-by: Chao Yu Thanks, > --- > fs/f2fs/xattr.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c > index 610d5810074d..18f495db20d2 100644 > --- a/fs/f2fs/xattr.c > +++ b/fs/f2fs/xattr.c > @@ -581,8 +581,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", > @@ -590,9 +588,12 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) > set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK); > f2fs_handle_error(F2FS_I_SB(inode), > ERROR_CORRUPTED_XATTR); > - break; > + error = -EFSCORRUPTED; > + goto cleanup; > } > > + prefix = f2fs_xattr_prefix(entry->e_name_index, dentry); > + > if (!prefix) > continue; >