Skip to content

Commit

Permalink
sysfs: make sysfs_put() ignore NULL sd
Browse files Browse the repository at this point in the history
Make sysfs_put() ignore NULL sd instead of oopsing.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Tejun Heo authored and Greg Kroah-Hartman committed Jul 11, 2007
1 parent 2b611bb commit 7a23ad4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/sysfs/sysfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static inline struct sysfs_dirent * sysfs_get(struct sysfs_dirent * sd)

static inline void sysfs_put(struct sysfs_dirent * sd)
{
if (atomic_dec_and_test(&sd->s_count))
if (sd && atomic_dec_and_test(&sd->s_count))
release_sysfs_dirent(sd);
}

Expand Down

0 comments on commit 7a23ad4

Please sign in to comment.