public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Peter Moody <pmoody@google.com>
To: linux-audit@redhat.com
Subject: [PATCH] audit: grab a reference to context->pwd when it's cached
Date: Wed, 15 Aug 2012 18:13:33 -0700	[thread overview]
Message-ID: <1345079613-27388-1-git-send-email-pmoody@google.com> (raw)

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

             reply	other threads:[~2012-08-16  1:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16  1:13 Peter Moody [this message]
2012-08-16  1:26 ` [PATCH] audit: grab a reference to context->pwd when it's cached 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1345079613-27388-1-git-send-email-pmoody@google.com \
    --to=pmoody@google.com \
    --cc=linux-audit@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox