Skip to content

Commit 24fb33d

Browse files
Al Virotorvalds
authored andcommitted
fix breakage in do_rmdir()
syzbot reported and bisected a use-after-free due to the recent init cleanups. The putname() should happen only after we'd *not* branched to retry, same as it's done in do_unlinkat(). Reported-by: [email protected] Fixes: e24ab0e "fs: push the getname from do_rmdir into the callers" Cc: Christoph Hellwig <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent fb893de commit 24fb33d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/namei.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3770,11 +3770,11 @@ long do_rmdir(int dfd, struct filename *name)
37703770
mnt_drop_write(path.mnt);
37713771
exit1:
37723772
path_put(&path);
3773-
putname(name);
37743773
if (retry_estale(error, lookup_flags)) {
37753774
lookup_flags |= LOOKUP_REVAL;
37763775
goto retry;
37773776
}
3777+
putname(name);
37783778
return error;
37793779
}
37803780

0 commit comments

Comments
 (0)