From: Tejun Heo Date: Wed, 13 Jun 2007 18:45:13 +0000 (+0900) Subject: sysfs: make sysfs_put() ignore NULL sd X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~44528^2~37 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=7a23ad44047b1084a032bc0d127fe08af024593a;p=mirror_ubuntu-focal-kernel.git sysfs: make sysfs_put() ignore NULL sd Make sysfs_put() ignore NULL sd instead of oopsing. Signed-off-by: Tejun Heo Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index 687d959f606d..f4fdbbffd571 100644 --- a/fs/sysfs/sysfs.h +++ b/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); }