diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-05-15 06:49:45 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-08-07 14:40:08 -0400 |
commit | 9df7fa16ee956bf0cdf4a711eac827be92d584bc (patch) | |
tree | f1f64e028f1b6c43c0fb52b367f739c0311a0c2d /kernel/acct.c | |
parent | 795a2f22a8eaf749e20a11271a8821bf04ac6d90 (diff) |
acct: serialize acct_on()
brute-force - on a global mutex that isn't nested into anything.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/acct.c')
-rw-r--r-- | kernel/acct.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/acct.c b/kernel/acct.c index 87773725a0dc..08963a292878 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -241,6 +241,8 @@ static int acct_on(struct filename *pathname) | |||
241 | return 0; | 241 | return 0; |
242 | } | 242 | } |
243 | 243 | ||
244 | static DEFINE_MUTEX(acct_on_mutex); | ||
245 | |||
244 | /** | 246 | /** |
245 | * sys_acct - enable/disable process accounting | 247 | * sys_acct - enable/disable process accounting |
246 | * @name: file name for accounting records or NULL to shutdown accounting | 248 | * @name: file name for accounting records or NULL to shutdown accounting |
@@ -263,7 +265,9 @@ SYSCALL_DEFINE1(acct, const char __user *, name) | |||
263 | struct filename *tmp = getname(name); | 265 | struct filename *tmp = getname(name); |
264 | if (IS_ERR(tmp)) | 266 | if (IS_ERR(tmp)) |
265 | return PTR_ERR(tmp); | 267 | return PTR_ERR(tmp); |
268 | mutex_lock(&acct_on_mutex); | ||
266 | error = acct_on(tmp); | 269 | error = acct_on(tmp); |
270 | mutex_unlock(&acct_on_mutex); | ||
267 | putname(tmp); | 271 | putname(tmp); |
268 | } else { | 272 | } else { |
269 | struct bsd_acct_struct *acct; | 273 | struct bsd_acct_struct *acct; |