Commit 9df7fa16 authored by Al Viro's avatar Al Viro

acct: serialize acct_on()

brute-force - on a global mutex that isn't nested into anything.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 795a2f22
...@@ -241,6 +241,8 @@ static int acct_on(struct filename *pathname) ...@@ -241,6 +241,8 @@ static int acct_on(struct filename *pathname)
return 0; return 0;
} }
static DEFINE_MUTEX(acct_on_mutex);
/** /**
* sys_acct - enable/disable process accounting * sys_acct - enable/disable process accounting
* @name: file name for accounting records or NULL to shutdown accounting * @name: file name for accounting records or NULL to shutdown accounting
...@@ -263,7 +265,9 @@ SYSCALL_DEFINE1(acct, const char __user *, name) ...@@ -263,7 +265,9 @@ SYSCALL_DEFINE1(acct, const char __user *, name)
struct filename *tmp = getname(name); struct filename *tmp = getname(name);
if (IS_ERR(tmp)) if (IS_ERR(tmp))
return PTR_ERR(tmp); return PTR_ERR(tmp);
mutex_lock(&acct_on_mutex);
error = acct_on(tmp); error = acct_on(tmp);
mutex_unlock(&acct_on_mutex);
putname(tmp); putname(tmp);
} else { } else {
struct bsd_acct_struct *acct; struct bsd_acct_struct *acct;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment