Pull erofs fixes from Gao Xiang: - Fix a UAF of sbi->sync_decompress when compressed I/Os race with unmount - Fix a regression introduced this development cycle that incorrectly rejects multiple-algorithm images * tag 'erofs-for-7.1-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs: erofs: fix EFSCORRUPTED on multi-algorithm images in z_erofs_map_sanity_check() erofs: fix use-after-free on sbi->sync_decompress
Unified · Split
| @@ -1455,6 +1455,9 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io, · 1454 unmodified lines | ||
| 1455 | 1455 | if (atomic_add_return(bios, &io->pending_bios)) |
| 1456 | 1456 | return; |
| 1457 | 1457 | if (z_erofs_in_atomic()) { |
| 1458 | + /* See `sync_decompress` in sysfs-fs-erofs for more details */ | |
| 1459 | + if (sbi->sync_decompress == EROFS_SYNC_DECOMPRESS_AUTO) | |
| 1460 | + sbi->sync_decompress = EROFS_SYNC_DECOMPRESS_FORCE_ON; | |
| 1458 | 1461 | #ifdef CONFIG_EROFS_FS_PCPU_KTHREAD |
| 1459 | 1462 | struct kthread_worker *worker; |
| 1460 | 1463 | |
| @@ -1471,9 +1474,6 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io, · 10 unmodified lines | ||
| 1471 | 1474 | #else |
| 1472 | 1475 | queue_work(z_erofs_workqueue, &io->u.work); |
| 1473 | 1476 | #endif |
| 1474 | − /* See `sync_decompress` in sysfs-fs-erofs for more details */ | |
| 1475 | − if (sbi->sync_decompress == EROFS_SYNC_DECOMPRESS_AUTO) | |
| 1476 | − sbi->sync_decompress = EROFS_SYNC_DECOMPRESS_FORCE_ON; | |
| 1477 | 1477 | return; |
| 1478 | 1478 | } |
| 1479 | 1479 | gfp_flag = memalloc_noio_save(); |
| @@ -716,7 +716,7 @@ static int z_erofs_map_sanity_check(struct inode *inode, · 715 unmodified lines | ||
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | if (map->m_algorithmformat < Z_EROFS_COMPRESSION_MAX) { |
| 719 | − if (sbi->available_compr_algs ^ BIT(map->m_algorithmformat)) { | |
| 719 | + if (!(sbi->available_compr_algs & BIT(map->m_algorithmformat))) { | |
| 720 | 720 | erofs_err(inode->i_sb, "inconsistent algorithmtype %u for nid %llu", |
| 721 | 721 | map->m_algorithmformat, EROFS_I(inode)->nid); |
| 722 | 722 | return -EFSCORRUPTED; |