linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* do_filp_open fails to detect dentry revalidate of 1 and crashes
@ 2008-10-02  6:17 jmerkey
       [not found] ` <44010.166.70.238.43.1222928236.squirrel@webmail.wolfmountaingroup.com >
  0 siblings, 1 reply; 2+ messages in thread
From: jmerkey @ 2008-10-02  6:17 UTC (permalink / raw)
  To: linux-kernel


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


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

* Re: do_filp_open fails to detect dentry revalidate of 1 and crashes
       [not found] ` <44010.166.70.238.43.1222928236.squirrel@webmail.wolfmountaingroup.com >
@ 2008-10-02  6:41   ` jmerkey
  0 siblings, 0 replies; 2+ messages in thread
From: jmerkey @ 2008-10-02  6:41 UTC (permalink / raw)
  To: linux-kernel

>
> 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;



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

end of thread, other threads:[~2008-10-02  7:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-02  6:17 do_filp_open fails to detect dentry revalidate of 1 and crashes jmerkey
     [not found] ` <44010.166.70.238.43.1222928236.squirrel@webmail.wolfmountaingroup.com >
2008-10-02  6:41   ` jmerkey

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).