Skip to content

Commit 70465ac

Browse files
YuezhangMonamjaejeon
authored andcommitted
exfat: fix exfat_find_empty_entry() not returning error on failure
On failure, "dentry" is the error code. If the error code indicates that there is no space, a new cluster may need to be allocated; for other errors, it should be returned directly. Only on success, "dentry" is the index of the directory entry, and it needs to be converted into the directory entry index within the cluster where it is located. Fixes: 8a3f571 ("exfat: reduce FAT chain traversal") Reported-by: syzbot+6f6c9397e0078ef60bce@syzkaller.appspotmail.com Tested-by: syzbot+6f6c9397e0078ef60bce@syzkaller.appspotmail.com Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com> Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent feffde6 commit 70465ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/exfat/namei.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ static int exfat_find_empty_entry(struct inode *inode,
330330

331331
while ((dentry = exfat_search_empty_slot(sb, &hint_femp, p_dir,
332332
num_entries, es)) < 0) {
333-
if (dentry == -EIO)
334-
break;
333+
if (dentry != -ENOSPC)
334+
return dentry;
335335

336336
if (exfat_check_max_dentries(inode))
337337
return -ENOSPC;

0 commit comments

Comments
 (0)