Skip to content

Commit 4ca0d98

Browse files
committed
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
2 parents 66a97c2 + 56ee7db commit 4ca0d98

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

fs/erofs/namei.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,24 +130,24 @@ static void *erofs_find_target_block(struct erofs_buf *target,
130130
/* string comparison without already matched prefix */
131131
diff = erofs_dirnamecmp(name, &dname, &matched);
132132

133-
if (!diff) {
134-
*_ndirents = 0;
135-
goto out;
136-
} else if (diff > 0) {
137-
head = mid + 1;
138-
startprfx = matched;
139-
140-
if (!IS_ERR(candidate))
141-
erofs_put_metabuf(target);
142-
*target = buf;
143-
candidate = de;
144-
*_ndirents = ndirents;
145-
} else {
133+
if (diff < 0) {
146134
erofs_put_metabuf(&buf);
147-
148135
back = mid - 1;
149136
endprfx = matched;
137+
continue;
138+
}
139+
140+
if (!IS_ERR(candidate))
141+
erofs_put_metabuf(target);
142+
*target = buf;
143+
if (!diff) {
144+
*_ndirents = 0;
145+
return de;
150146
}
147+
head = mid + 1;
148+
startprfx = matched;
149+
candidate = de;
150+
*_ndirents = ndirents;
151151
continue;
152152
}
153153
out: /* free if the candidate is valid */

0 commit comments

Comments
 (0)