Commit 4ca0d989 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull erofs fix from Gao Xiang:

 - Fix page refcount leak when looking up specific inodes
   introduced by metabuf reworking

* tag 'erofs-for-6.8-rc6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
  erofs: fix refcount on the metabuf used for inode lookup
parents 66a97c2e 56ee7db3
...@@ -130,24 +130,24 @@ static void *erofs_find_target_block(struct erofs_buf *target, ...@@ -130,24 +130,24 @@ static void *erofs_find_target_block(struct erofs_buf *target,
/* string comparison without already matched prefix */ /* string comparison without already matched prefix */
diff = erofs_dirnamecmp(name, &dname, &matched); diff = erofs_dirnamecmp(name, &dname, &matched);
if (!diff) { if (diff < 0) {
*_ndirents = 0;
goto out;
} else if (diff > 0) {
head = mid + 1;
startprfx = matched;
if (!IS_ERR(candidate))
erofs_put_metabuf(target);
*target = buf;
candidate = de;
*_ndirents = ndirents;
} else {
erofs_put_metabuf(&buf); erofs_put_metabuf(&buf);
back = mid - 1; back = mid - 1;
endprfx = matched; endprfx = matched;
continue;
}
if (!IS_ERR(candidate))
erofs_put_metabuf(target);
*target = buf;
if (!diff) {
*_ndirents = 0;
return de;
} }
head = mid + 1;
startprfx = matched;
candidate = de;
*_ndirents = ndirents;
continue; continue;
} }
out: /* free if the candidate is valid */ out: /* free if the candidate is valid */
......
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