Commit a5e0acea authored by Linus Torvalds's avatar Linus Torvalds

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

Pull erofs fixes from Gao Xiang:
 "Two bugfixes to fix the 4KiB blockmap chunk format availability and a
  dangling pointer usage. There is also a trivial cleanup to clarify
  compacted_2b if compacted_4b_initial > totalidx.

  Summary:

   - fix the dangling pointer use in erofs_lookup tracepoint

   - fix unsupported chunk format check

   - zero out compacted_2b if compacted_4b_initial > totalidx"

* tag 'erofs-for-5.15-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
  erofs: clear compacted_2b if compacted_4b_initial > totalidx
  erofs: fix misbehavior of unsupported chunk format check
  erofs: fix up erofs_lookup tracepoint
parents b8f42965 c40dd3ca
...@@ -176,7 +176,7 @@ static struct page *erofs_read_inode(struct inode *inode, ...@@ -176,7 +176,7 @@ static struct page *erofs_read_inode(struct inode *inode,
} }
if (vi->datalayout == EROFS_INODE_CHUNK_BASED) { if (vi->datalayout == EROFS_INODE_CHUNK_BASED) {
if (!(vi->chunkformat & EROFS_CHUNK_FORMAT_ALL)) { if (vi->chunkformat & ~EROFS_CHUNK_FORMAT_ALL) {
erofs_err(inode->i_sb, erofs_err(inode->i_sb,
"unsupported chunk format %x of nid %llu", "unsupported chunk format %x of nid %llu",
vi->chunkformat, vi->nid); vi->chunkformat, vi->nid);
......
...@@ -369,7 +369,8 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, ...@@ -369,7 +369,8 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
if (compacted_4b_initial == 32 / 4) if (compacted_4b_initial == 32 / 4)
compacted_4b_initial = 0; compacted_4b_initial = 0;
if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) &&
compacted_4b_initial < totalidx)
compacted_2b = rounddown(totalidx - compacted_4b_initial, 16); compacted_2b = rounddown(totalidx - compacted_4b_initial, 16);
else else
compacted_2b = 0; compacted_2b = 0;
......
...@@ -35,20 +35,20 @@ TRACE_EVENT(erofs_lookup, ...@@ -35,20 +35,20 @@ TRACE_EVENT(erofs_lookup,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(dev_t, dev ) __field(dev_t, dev )
__field(erofs_nid_t, nid ) __field(erofs_nid_t, nid )
__field(const char *, name ) __string(name, dentry->d_name.name )
__field(unsigned int, flags ) __field(unsigned int, flags )
), ),
TP_fast_assign( TP_fast_assign(
__entry->dev = dir->i_sb->s_dev; __entry->dev = dir->i_sb->s_dev;
__entry->nid = EROFS_I(dir)->nid; __entry->nid = EROFS_I(dir)->nid;
__entry->name = dentry->d_name.name; __assign_str(name, dentry->d_name.name);
__entry->flags = flags; __entry->flags = flags;
), ),
TP_printk("dev = (%d,%d), pnid = %llu, name:%s, flags:%x", TP_printk("dev = (%d,%d), pnid = %llu, name:%s, flags:%x",
show_dev_nid(__entry), show_dev_nid(__entry),
__entry->name, __get_str(name),
__entry->flags) __entry->flags)
); );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment