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.

Merge tag 'erofs-for-6.8-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs

Pull erofs fixes from Gao Xiang:

- Fix a "BUG: kernel NULL pointer dereference" issue due to
inconsistent on-disk indices of compressed inodes against
per-sb `available_compr_algs` generated by Syzkaller

- Don't use certain unnecessary folio_*() helpers if the folio
type (page cache) is known

* tag 'erofs-for-6.8-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
erofs: Don't use certain unnecessary folio_*() functions
erofs: fix inconsistent per-file compression format

+17 -14
+1 -1
fs/erofs/decompressor.c
··· 408 408 int size, ret = 0; 409 409 410 410 if (!erofs_sb_has_compr_cfgs(sbi)) { 411 - sbi->available_compr_algs = Z_EROFS_COMPRESSION_LZ4; 411 + sbi->available_compr_algs = 1 << Z_EROFS_COMPRESSION_LZ4; 412 412 return z_erofs_load_lz4_config(sb, dsb, NULL, 0); 413 413 } 414 414
+3 -3
fs/erofs/fscache.c
··· 165 165 static int erofs_fscache_meta_read_folio(struct file *data, struct folio *folio) 166 166 { 167 167 int ret; 168 - struct erofs_fscache *ctx = folio_mapping(folio)->host->i_private; 168 + struct erofs_fscache *ctx = folio->mapping->host->i_private; 169 169 struct erofs_fscache_request *req; 170 170 171 - req = erofs_fscache_req_alloc(folio_mapping(folio), 171 + req = erofs_fscache_req_alloc(folio->mapping, 172 172 folio_pos(folio), folio_size(folio)); 173 173 if (IS_ERR(req)) { 174 174 folio_unlock(folio); ··· 276 276 struct erofs_fscache_request *req; 277 277 int ret; 278 278 279 - req = erofs_fscache_req_alloc(folio_mapping(folio), 279 + req = erofs_fscache_req_alloc(folio->mapping, 280 280 folio_pos(folio), folio_size(folio)); 281 281 if (IS_ERR(req)) { 282 282 folio_unlock(folio);
+13 -10
fs/erofs/zmap.c
··· 454 454 .map = map, 455 455 }; 456 456 int err = 0; 457 - unsigned int lclusterbits, endoff; 457 + unsigned int lclusterbits, endoff, afmt; 458 458 unsigned long initial_lcn; 459 459 unsigned long long ofs, end; 460 460 ··· 543 543 err = -EFSCORRUPTED; 544 544 goto unmap_out; 545 545 } 546 - if (vi->z_advise & Z_EROFS_ADVISE_INTERLACED_PCLUSTER) 547 - map->m_algorithmformat = 548 - Z_EROFS_COMPRESSION_INTERLACED; 549 - else 550 - map->m_algorithmformat = 551 - Z_EROFS_COMPRESSION_SHIFTED; 552 - } else if (m.headtype == Z_EROFS_LCLUSTER_TYPE_HEAD2) { 553 - map->m_algorithmformat = vi->z_algorithmtype[1]; 546 + afmt = vi->z_advise & Z_EROFS_ADVISE_INTERLACED_PCLUSTER ? 547 + Z_EROFS_COMPRESSION_INTERLACED : 548 + Z_EROFS_COMPRESSION_SHIFTED; 554 549 } else { 555 - map->m_algorithmformat = vi->z_algorithmtype[0]; 550 + afmt = m.headtype == Z_EROFS_LCLUSTER_TYPE_HEAD2 ? 551 + vi->z_algorithmtype[1] : vi->z_algorithmtype[0]; 552 + if (!(EROFS_I_SB(inode)->available_compr_algs & (1 << afmt))) { 553 + erofs_err(inode->i_sb, "inconsistent algorithmtype %u for nid %llu", 554 + afmt, vi->nid); 555 + err = -EFSCORRUPTED; 556 + goto unmap_out; 557 + } 556 558 } 559 + map->m_algorithmformat = afmt; 557 560 558 561 if ((flags & EROFS_GET_BLOCKS_FIEMAP) || 559 562 ((flags & EROFS_GET_BLOCKS_READMORE) &&