Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ntfs: validate WSL EA payload sizes

Enforce the exact-size reads for $LXUID, $LXGID, $LXMOD, $LXDEV.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>

authored by

Hyunchul Lee and committed by
Namjae Jeon
a5325419 a7325868

+6 -2
+6 -2
fs/ntfs/ea.c
··· 365 365 sizeof(v)); 366 366 if (err < 0) 367 367 return err; 368 + if (err != sizeof(v)) 369 + return -EIO; 368 370 i_uid_write(inode, le32_to_cpu(v)); 369 371 } 370 372 ··· 376 374 sizeof(v)); 377 375 if (err < 0) 378 376 return err; 377 + if (err != sizeof(v)) 378 + return -EIO; 379 379 i_gid_write(inode, le32_to_cpu(v)); 380 380 } 381 381 382 382 /* Load mode to lxmod EA */ 383 383 err = ntfs_get_ea(inode, "$LXMOD", sizeof("$LXMOD") - 1, &v, sizeof(v)); 384 - if (err > 0) { 384 + if (err == sizeof(v)) { 385 385 inode->i_mode = le32_to_cpu(v); 386 386 } else { 387 387 /* Everyone gets all permissions. */ ··· 392 388 393 389 /* Load mode to lxdev EA */ 394 390 err = ntfs_get_ea(inode, "$LXDEV", sizeof("$LXDEV") - 1, &v, sizeof(v)); 395 - if (err > 0) 391 + if (err == sizeof(v)) 396 392 *rdevp = le32_to_cpu(v); 397 393 err = 0; 398 394