From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Moody Subject: [PATCH] audit: grab a reference to context->pwd when it's cached Date: Wed, 15 Aug 2012 18:13:33 -0700 Message-ID: <1345079613-27388-1-git-send-email-pmoody@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.17]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q7G1Dpjo011645 for ; Wed, 15 Aug 2012 21:13:51 -0400 Received: from mail-pb0-f46.google.com (mail-pb0-f46.google.com [209.85.160.46]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7G1DoPZ031022 for ; Wed, 15 Aug 2012 21:13:50 -0400 Received: by pbbrr13 with SMTP id rr13so716839pbb.33 for ; Wed, 15 Aug 2012 18:13:49 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: linux-audit@redhat.com List-Id: linux-audit@redhat.com 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 --- 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