Skip to content

Commit

Permalink
acct: serialize acct_on()
Browse files Browse the repository at this point in the history
brute-force - on a global mutex that isn't nested into anything.

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Aug 7, 2014
1 parent 795a2f2 commit 9df7fa1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kernel/acct.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ static int acct_on(struct filename *pathname)
return 0;
}

static DEFINE_MUTEX(acct_on_mutex);

/**
* sys_acct - enable/disable process accounting
* @name: file name for accounting records or NULL to shutdown accounting
Expand All @@ -263,7 +265,9 @@ SYSCALL_DEFINE1(acct, const char __user *, name)
struct filename *tmp = getname(name);
if (IS_ERR(tmp))
return PTR_ERR(tmp);
mutex_lock(&acct_on_mutex);
error = acct_on(tmp);
mutex_unlock(&acct_on_mutex);
putname(tmp);
} else {
struct bsd_acct_struct *acct;
Expand Down

0 comments on commit 9df7fa1

Please sign in to comment.