linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] inotify: check for NULL inode in inotify_d_instantiate
@ 2006-04-07 16:08 Arnd Bergmann
  2006-04-08  3:06 ` Nick Piggin
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2006-04-07 16:08 UTC (permalink / raw)
  To: Nick Piggin; +Cc: cbe-oss-dev, linux-kernel

The spufs file system creates files in a directory before instantiating
the directory itself, which causes a NULL pointer access in
inotify_d_instantiate since c32ccd87bfd1414b0aabfcd8dbc7539ad23bcbaa.

I'd like to keep this behavior since it means that the user
will not have access to files in the directory before I know
that I succeed in creating everything in it. This patch adds
a simple check for the inode to keep that working.

Cc: Nick Piggin <npiggin@suse.de>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
---

diff --git a/fs/inotify.c b/fs/inotify.c
index 367c487..1f50302 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -538,7 +538,7 @@ void inotify_d_instantiate(struct dentry
 	WARN_ON(entry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED);
 	spin_lock(&entry->d_lock);
 	parent = entry->d_parent;
-	if (inotify_inode_watched(parent->d_inode))
+	if (parent->d_inode && inotify_inode_watched(parent->d_inode))
 		entry->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED;
 	spin_unlock(&entry->d_lock);
 }

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

* Re: [PATCH] inotify: check for NULL inode in inotify_d_instantiate
  2006-04-07 16:08 [PATCH] inotify: check for NULL inode in inotify_d_instantiate Arnd Bergmann
@ 2006-04-08  3:06 ` Nick Piggin
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Piggin @ 2006-04-08  3:06 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Nick Piggin, cbe-oss-dev, linux-kernel

On Fri, Apr 07, 2006 at 06:08:41PM +0200, Arnd Bergmann wrote:
> The spufs file system creates files in a directory before instantiating
> the directory itself, which causes a NULL pointer access in
> inotify_d_instantiate since c32ccd87bfd1414b0aabfcd8dbc7539ad23bcbaa.
> 
> I'd like to keep this behavior since it means that the user
> will not have access to files in the directory before I know
> that I succeed in creating everything in it. This patch adds
> a simple check for the inode to keep that working.
> 

If this were not the correct thing to do, it is not the
business of c32ccd87bfd1414b0aabfcd8dbc7539ad23bcbaa to
prevent it. Thanks.

Acked-by: Nick Piggin <npiggin@suse.de>


> Cc: Nick Piggin <npiggin@suse.de>
> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
> ---
> 
> diff --git a/fs/inotify.c b/fs/inotify.c
> index 367c487..1f50302 100644
> --- a/fs/inotify.c
> +++ b/fs/inotify.c
> @@ -538,7 +538,7 @@ void inotify_d_instantiate(struct dentry
>  	WARN_ON(entry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED);
>  	spin_lock(&entry->d_lock);
>  	parent = entry->d_parent;
> -	if (inotify_inode_watched(parent->d_inode))
> +	if (parent->d_inode && inotify_inode_watched(parent->d_inode))
>  		entry->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED;
>  	spin_unlock(&entry->d_lock);
>  }

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

end of thread, other threads:[~2006-04-08  3:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-07 16:08 [PATCH] inotify: check for NULL inode in inotify_d_instantiate Arnd Bergmann
2006-04-08  3:06 ` Nick Piggin

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