mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
jfs: xattr: check invalid xattr size more strictly
Commit 7c55b78818
("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>
This commit is contained in:
parent
839f102efb
commit
d9f9d96136
1 changed files with 1 additions and 1 deletions
|
@ -559,7 +559,7 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
|
||||||
|
|
||||||
size_check:
|
size_check:
|
||||||
if (EALIST_SIZE(ea_buf->xattr) != ea_size) {
|
if (EALIST_SIZE(ea_buf->xattr) != ea_size) {
|
||||||
int size = min_t(int, EALIST_SIZE(ea_buf->xattr), ea_size);
|
int size = clamp_t(int, ea_size, 0, EALIST_SIZE(ea_buf->xattr));
|
||||||
|
|
||||||
printk(KERN_ERR "ea_get: invalid extended attribute\n");
|
printk(KERN_ERR "ea_get: invalid extended attribute\n");
|
||||||
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_ADDRESS, 16, 1,
|
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_ADDRESS, 16, 1,
|
||||||
|
|
Loading…
Add table
Reference in a new issue