]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.0/acct_on-don-t-mess-with-freeze-protection.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / queue-5.0 / acct_on-don-t-mess-with-freeze-protection.patch
1 From 9419a3191dcb27f24478d288abaab697228d28e6 Mon Sep 17 00:00:00 2001
2 From: Al Viro <viro@zeniv.linux.org.uk>
3 Date: Thu, 4 Apr 2019 21:04:13 -0400
4 Subject: acct_on(): don't mess with freeze protection
5
6 From: Al Viro <viro@zeniv.linux.org.uk>
7
8 commit 9419a3191dcb27f24478d288abaab697228d28e6 upstream.
9
10 What happens there is that we are replacing file->path.mnt of
11 a file we'd just opened with a clone and we need the write
12 count contribution to be transferred from original mount to
13 new one. That's it. We do *NOT* want any kind of freeze
14 protection for the duration of switchover.
15
16 IOW, we should just use __mnt_{want,drop}_write() for that
17 switchover; no need to bother with mnt_{want,drop}_write()
18 there.
19
20 Tested-by: Amir Goldstein <amir73il@gmail.com>
21 Reported-by: syzbot+2a73a6ea9507b7112141@syzkaller.appspotmail.com
22 Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25 ---
26 fs/internal.h | 2 --
27 include/linux/mount.h | 2 ++
28 kernel/acct.c | 4 ++--
29 3 files changed, 4 insertions(+), 4 deletions(-)
30
31 --- a/fs/internal.h
32 +++ b/fs/internal.h
33 @@ -80,9 +80,7 @@ extern int sb_prepare_remount_readonly(s
34
35 extern void __init mnt_init(void);
36
37 -extern int __mnt_want_write(struct vfsmount *);
38 extern int __mnt_want_write_file(struct file *);
39 -extern void __mnt_drop_write(struct vfsmount *);
40 extern void __mnt_drop_write_file(struct file *);
41
42 /*
43 --- a/include/linux/mount.h
44 +++ b/include/linux/mount.h
45 @@ -86,6 +86,8 @@ extern bool mnt_may_suid(struct vfsmount
46
47 struct path;
48 extern struct vfsmount *clone_private_mount(const struct path *path);
49 +extern int __mnt_want_write(struct vfsmount *);
50 +extern void __mnt_drop_write(struct vfsmount *);
51
52 struct file_system_type;
53 extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
54 --- a/kernel/acct.c
55 +++ b/kernel/acct.c
56 @@ -227,7 +227,7 @@ static int acct_on(struct filename *path
57 filp_close(file, NULL);
58 return PTR_ERR(internal);
59 }
60 - err = mnt_want_write(internal);
61 + err = __mnt_want_write(internal);
62 if (err) {
63 mntput(internal);
64 kfree(acct);
65 @@ -252,7 +252,7 @@ static int acct_on(struct filename *path
66 old = xchg(&ns->bacct, &acct->pin);
67 mutex_unlock(&acct->lock);
68 pin_kill(old);
69 - mnt_drop_write(mnt);
70 + __mnt_drop_write(mnt);
71 mntput(mnt);
72 return 0;
73 }