Skip to content

Commit 9419a31

Browse files
author
Al Viro
committed
acct_on(): don't mess with freeze protection
What happens there is that we are replacing file->path.mnt of a file we'd just opened with a clone and we need the write count contribution to be transferred from original mount to new one. That's it. We do *NOT* want any kind of freeze protection for the duration of switchover. IOW, we should just use __mnt_{want,drop}_write() for that switchover; no need to bother with mnt_{want,drop}_write() there. Tested-by: Amir Goldstein <amir73il@gmail.com> Reported-by: syzbot+2a73a6ea9507b7112141@syzkaller.appspotmail.com Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 79a3aaa commit 9419a31

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎fs/internal.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ extern int sb_prepare_remount_readonly(struct super_block *);
8989

9090
extern void __init mnt_init(void);
9191

92-
extern int __mnt_want_write(struct vfsmount *);
9392
extern int __mnt_want_write_file(struct file *);
94-
extern void __mnt_drop_write(struct vfsmount *);
9593
extern void __mnt_drop_write_file(struct file *);
9694

9795
/*

‎include/linux/mount.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ extern bool mnt_may_suid(struct vfsmount *mnt);
8787

8888
struct path;
8989
extern struct vfsmount *clone_private_mount(const struct path *path);
90+
extern int __mnt_want_write(struct vfsmount *);
91+
extern void __mnt_drop_write(struct vfsmount *);
9092

9193
struct file_system_type;
9294
extern struct vfsmount *fc_mount(struct fs_context *fc);

‎kernel/acct.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static int acct_on(struct filename *pathname)
227227
filp_close(file, NULL);
228228
return PTR_ERR(internal);
229229
}
230-
err = mnt_want_write(internal);
230+
err = __mnt_want_write(internal);
231231
if (err) {
232232
mntput(internal);
233233
kfree(acct);
@@ -252,7 +252,7 @@ static int acct_on(struct filename *pathname)
252252
old = xchg(&ns->bacct, &acct->pin);
253253
mutex_unlock(&acct->lock);
254254
pin_kill(old);
255-
mnt_drop_write(mnt);
255+
__mnt_drop_write(mnt);
256256
mntput(mnt);
257257
return 0;
258258
}

0 commit comments

Comments
 (0)