Re: minor patch for 2.1.111 fs/open.c

Bill Hawes (whawes@transmeta.com)
Tue, 28 Jul 1998 11:01:02 -0700


Linus Torvalds wrote:

> This patch can't make any difference that I can see.
>
> At the point where you clear the f_dentry, the whole file pointer is
> completely local to the open routine (it hasn't been installed anywhere),
> so nobody else can have a pointer to it. As such, nobody else could
> dereference the field except for us (and we won't do that, because we're
> just about to destroy it).

The problem is that the filp is on the inuse list, and that list effectively
makes the filp public. There are a number of places where kernel routines
walk the inuse filp list and do things to the filps. For this to be safe,
the dentry pointer (if it's non-NULL) must be valid.

> It would indeed be a major bug to expose the file pointer before it is
> completely filled in, but that is regardless of whether we have a stale
> dentry pointer or any dentry at all..

The users of the inuse list are supposed to check for NULL f_dentry and
ignore it -- I posted a patch for the quota code to fix a missing test. But
we can't allow a stale dentry pointer ...

Regards,
Bill

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html