All of lore.kernel.org
 help / color / mirror / Atom feed
* sysfs_drop_dentry(): possible NULL dereference
@ 2007-03-19  9:22 Adrian Bunk
  2007-03-19 10:09 ` Oliver Neukum
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2007-03-19  9:22 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: Greg Kroah-Hartman, Maneesh Soni, linux-kernel

The Coverity checker spotted the following incorrect part of
commit 94bebf4d1b8e7719f0f3944c037a21cfd99a4af7:

<--  snip  -->

...
 void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent)
 {
        struct dentry * dentry = sd->s_dentry;
+       struct inode *inode;
 
        if (dentry) {
                spin_lock(&dcache_lock);
                spin_lock(&dentry->d_lock);
                if (!(d_unhashed(dentry) && dentry->d_inode)) {
+                       inode = dentry->d_inode;
+                       spin_lock(&inode->i_lock);
...

<--  snip  -->

If (!dentry->d_inode), then it's a NULL dereference.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: sysfs_drop_dentry(): possible NULL dereference
  2007-03-19  9:22 sysfs_drop_dentry(): possible NULL dereference Adrian Bunk
@ 2007-03-19 10:09 ` Oliver Neukum
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Neukum @ 2007-03-19 10:09 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Greg Kroah-Hartman, Maneesh Soni, linux-kernel

Am Montag, 19. März 2007 10:22 schrieb Adrian Bunk:

>  void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent)
>  {
>         struct dentry * dentry = sd->s_dentry;
> +       struct inode *inode;
>  
>         if (dentry) {
>                 spin_lock(&dcache_lock);
>                 spin_lock(&dentry->d_lock);
>                 if (!(d_unhashed(dentry) && dentry->d_inode)) {
> +                       inode = dentry->d_inode;
> +                       spin_lock(&inode->i_lock);
> ...
> 
> <--  snip  -->
> 
> If (!dentry->d_inode), then it's a NULL dereference.

As far as I can tell, sysfs being a virtual filesystem, does not use
dentries without inodes associated.

	Regards
		Oliver

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

end of thread, other threads:[~2007-03-19 10:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-19  9:22 sysfs_drop_dentry(): possible NULL dereference Adrian Bunk
2007-03-19 10:09 ` Oliver Neukum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.