mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: jmerkey@wolfmountaingroup.com
To: linux-kernel@vger.kernel.org
Subject: Re: do_filp_open fails to detect dentry revalidate of 1 and crashes
Date: Thu, 2 Oct 2008 00:41:44 -0600 (MDT)	[thread overview]
Message-ID: <53152.166.70.238.43.1222929704.squirrel@webmail.wolfmountaingroup.com> (raw)
In-Reply-To: <44010.166.70.238.43.1222928236.squirrel@webmail.wolfmountaingroup.com >

>
> On assignment of a negative dentry, do_filp_open will crash with an oops
> in do_sys_open because do_filp_open returns "1" from revalidate rather
> than properly detect a negative dentry which has a dentry revalidate
> function before the file actually exists.
>
>
> Easy to reproduce.  Create negative dentry and attach a revalidate
> function which returns 1 instead of 0 on non-existent file entry.   The
> convoluted code in do_filp_open does not detect dentry errors in all cases
> properly.
>
> Jeff
>

Correction:

It's vfs_create that fails to check return codes properly.

        /*
         * Create - we need to know the parent.
         */
        error = path_lookup_create(dfd, pathname, LOOKUP_PARENT,
                                   &nd, flag, mode);


////
If ERROR is a positive value, ERR_PTR fails to convert it to a negative
value.  This causes the EDI register to get set to "1" after do_filp_open
returns.

////

        if (error)
                return ERR_PTR(error);



        /*
         * We have the parent and last component. First of all, check
         * that we are not asked to creat(2) an obvious directory - that
         * will not do.
         */
        error = -EISDIR;
        if (nd.last_type != LAST_NORM || nd.last.name[nd.last.len])
                goto exit;



      parent reply	other threads:[~2008-10-02  7:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-02  6:17 jmerkey
     [not found] ` <44010.166.70.238.43.1222928236.squirrel@webmail.wolfmountaingroup.com >
2008-10-02  6:41   ` jmerkey [this message]

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=53152.166.70.238.43.1222929704.squirrel@webmail.wolfmountaingroup.com \
    --to=jmerkey@wolfmountaingroup.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®