Explorar o código

sysfs: make sysfs_put() ignore NULL sd

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>
Tejun Heo %!s(int64=18) %!d(string=hai) anos
pai
achega
7a23ad4404
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      fs/sysfs/sysfs.h

+ 1 - 1
fs/sysfs/sysfs.h

@@ -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);
 }