Commit 9df7fa16ee956bf0cdf4a711eac827be92d584bc
1 parent
795a2f22a8
Exists in
smarc_imx_lf-5.15.y
and in
32 other branches
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>
Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff
kernel/acct.c
... | ... | @@ -241,6 +241,8 @@ |
241 | 241 | return 0; |
242 | 242 | } |
243 | 243 | |
244 | +static DEFINE_MUTEX(acct_on_mutex); | |
245 | + | |
244 | 246 | /** |
245 | 247 | * sys_acct - enable/disable process accounting |
246 | 248 | * @name: file name for accounting records or NULL to shutdown accounting |
247 | 249 | |
... | ... | @@ -263,7 +265,9 @@ |
263 | 265 | struct filename *tmp = getname(name); |
264 | 266 | if (IS_ERR(tmp)) |
265 | 267 | return PTR_ERR(tmp); |
268 | + mutex_lock(&acct_on_mutex); | |
266 | 269 | error = acct_on(tmp); |
270 | + mutex_unlock(&acct_on_mutex); | |
267 | 271 | putname(tmp); |
268 | 272 | } else { |
269 | 273 | struct bsd_acct_struct *acct; |