public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
* [PATCH] audit: grab a reference to context->pwd when it's cached
@ 2012-08-16  1:13 Peter Moody
  2012-08-16  1:26 ` Alexander Viro
  0 siblings, 1 reply; 26+ messages in thread
From: Peter Moody @ 2012-08-16  1:13 UTC (permalink / raw)
  To: linux-audit

On certain systems, in certain pathalogical cases, current's cwd can
be deleted while we're still processing a syscall. This should prevent
the system from evicting the inode while we're still referencing it.

This seems to fix the bug I reported here:
https://www.redhat.com/archives/linux-audit/2012-August/msg00017.html

Signed-off-by: Peter Moody <pmoody@google.com>
---
 kernel/auditsc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 4b96415..e86b8b9 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -2064,6 +2064,7 @@ void __audit_getname(const char *name)
 
 	if (!context->pwd.dentry)
 		get_fs_pwd(current->fs, &context->pwd);
+	path_get(&context->pwd);
 }
 
 /* audit_putname - intercept a putname request
@@ -2091,6 +2092,7 @@ void audit_putname(const char *name)
 				       n->name, n->name ?: "(null)");
 			}
 #endif
+		path_put(&context->pwd);
 		__putname(name);
 	}
 #if AUDIT_DEBUG
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2012-10-08 18:48 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-16  1:13 [PATCH] audit: grab a reference to context->pwd when it's cached Peter Moody
2012-08-16  1:26 ` Alexander Viro
2012-08-16  1:41   ` Peter Moody
2012-08-20 17:19     ` Peter Moody
2012-09-25 17:03       ` Peter Moody
2012-09-26 13:50         ` Alexander Viro
2012-09-26 18:20           ` Peter Moody
2012-10-04 18:48           ` Peter Moody
2012-10-05 11:02             ` Jeff Layton
2012-10-05 12:55             ` Jeff Layton
2012-10-05 13:57               ` Peter Moody
2012-10-05 14:10                 ` Jeff Layton
2012-10-05 14:26                 ` Jeff Layton
2012-10-05 15:16                   ` Peter Moody
2012-10-05 15:18                     ` Peter Moody
2012-10-05 15:57                       ` Peter Moody
2012-10-05 16:15                         ` Jeff Layton
2012-10-05 17:04                           ` Peter Moody
2012-10-05 19:41                             ` Peter Moody
2012-10-08 12:23                               ` Jeff Layton
2012-10-08 15:22                                 ` Peter Moody
2012-10-08 16:45                                   ` Peter Moody
2012-10-08 14:10                             ` Jeff Layton
2012-10-05 20:23                         ` Eric Sandeen
2012-10-07  3:22                           ` Peter Moody
2012-10-08 18:48                             ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox