From 91bcca24b48daf7b62ed21ad4b267203245c040d Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Sun, 7 Mar 2004 20:29:33 -0800 Subject: [PATCH] [PATCH] proper error cleanup on security_acct hook Noted by Stephen Smalley: sys_acct does not properly clean up the open file when the security_acct hook returns an error. Fixed thus. --- kernel/acct.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/acct.c b/kernel/acct.c index a679f4bb98542..cf50df59177a3 100644 --- a/kernel/acct.c +++ b/kernel/acct.c @@ -235,8 +235,11 @@ asmlinkage long sys_acct(const char *name) } error = security_acct(file); - if (error) + if (error) { + if (file) + filp_close(file, NULL); return error; + } spin_lock(&acct_globals.lock); acct_file_reopen(file); -- 2.53.0