]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
jfs: xattr: check invalid xattr size more strictly
authorArtem Sadovnikov <ancowi69@gmail.com>
Sat, 5 Oct 2024 10:06:57 +0000 (10:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:12 +0000 (19:51 +0100)
commit27a93c45e16ac25a0e2b5e5668e2d1beca56a478
treee32e3dbc84c17f628937d27ad9672cf4d86ae8a5
parent8d72b5c93360c72b1cb4941c52ac5b9704438304
jfs: xattr: check invalid xattr size more strictly

commit d9f9d96136cba8fedd647d2c024342ce090133c2 upstream.

Commit 7c55b78818cf ("jfs: xattr: fix buffer overflow for invalid xattr")
also addresses this issue but it only fixes it for positive values, while
ea_size is an integer type and can take negative values, e.g. in case of
a corrupted filesystem. This still breaks validation and would overflow
because of implicit conversion from int to size_t in print_hex_dump().

Fix this issue by clamping the ea_size value instead.

Found by Linux Verification Center (linuxtesting.org) with Syzkaller.

Cc: stable@vger.kernel.org
Signed-off-by: Artem Sadovnikov <ancowi69@gmail.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/jfs/xattr.c