linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: Miklos Szeredi <mszeredi@suse.cz>
Cc: Peter Moody <pmoody@google.com>,
	linux-kernel@vger.kernel.org, Kees Cook <keescook@google.com>,
	viro@zeniv.linux.org.uk, miklos@szeredi.hu, jlayton@redhat.com,
	linux-fsdevel@vger.kernel.org
Subject: Re: Oops in audit_copy_inode
Date: Thu, 02 Aug 2012 14:34:57 -0400	[thread overview]
Message-ID: <1343932497.2605.1.camel@localhost> (raw)
In-Reply-To: <1343837499.18359.7.camel@tucsk.pomaz.szeredi.hu>

I believe this was already found and fixed:

https://lkml.org/lkml/2012/7/25/259

Which was pulled by Linus in:

3134f37e931d75931bdf6d4eacd82a3fd26eca7c

-Eric

On Wed, 2012-08-01 at 18:11 +0200, Miklos Szeredi wrote:
> Hi Peter,
> 
> Thanks for the report.
> 
> Here's a patch.  I haven't tested it but I'm pretty confident that it
> fixes the bug.
> 
> Thanks,
> Miklos
> 
> 
> Subject: vfs: fix audit_inode on negative dentry
> From: Miklos Szeredi <mszeredi@suse.cz>
> 
> Peter Moody reported an oops in audit_copy_inode() and bisected it to commit
> 7157486541 (vfs: do_last(): common slow lookup).
> 
> The problem is that audit_inode() in do_last() is called with a negative dentry.
> 
> Previously the non-O_CREAT case didn't call audit_inode() here, but now both
> O_CREAT and non-O_CREAT opens are handled by the same code.
> 
> I really have no idea why this audit_inode() is needed here at all but am afaid
> to remove this for fear of breaking audit somehow.  So just fix this case by
> checking for a negative dentry.
> 
> Reported-by: Peter Moody <pmoody@google.com>
> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
> CC: stable@vger.kernel.org
> ---
>  fs/namei.c |   10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6/fs/namei.c
> ===================================================================
> --- linux-2.6.orig/fs/namei.c	2012-08-01 17:47:28.000000000 +0200
> +++ linux-2.6/fs/namei.c	2012-08-01 17:49:26.000000000 +0200
> @@ -2607,10 +2607,12 @@ static int do_last(struct nameidata *nd,
>  		goto finish_open_created;
>  	}
>  
> -	/*
> -	 * It already exists.
> -	 */
> -	audit_inode(pathname, path->dentry);
> +	if (path->dentry->d_inode) {
> +		/*
> +		 * It already exists.
> +		 */
> +		audit_inode(pathname, path->dentry);
> +	}
>  
>  	/*
>  	 * If atomic_open() acquired write access it is dropped now due to
> 
> 



       reply	other threads:[~2012-08-02 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CALnj_=4r0qdrNUbXmS=q=sk11PZ-Q0z=wPO5wR_DzR4HjnMdqw@mail.gmail.com>
     [not found] ` <CALnj_=5qfAxtKN_T+eoAPCswZPrWmKmOK5HSTwCNZV0s08f_qw@mail.gmail.com>
     [not found]   ` <1343837499.18359.7.camel@tucsk.pomaz.szeredi.hu>
2012-08-02 18:34     ` Eric Paris [this message]
2012-08-03  7:37       ` Oops in audit_copy_inode Miklos Szeredi

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=1343932497.2605.1.camel@localhost \
    --to=eparis@redhat.com \
    --cc=jlayton@redhat.com \
    --cc=keescook@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mszeredi@suse.cz \
    --cc=pmoody@google.com \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).