Skip to content

Commit 0bbab5f

Browse files
committed
cfg80211: fix debugfs rename crash
Removing the "if (IS_ERR(dir)) dir = NULL;" check only works if we adjust the remaining code to not rely on it being NULL. Check IS_ERR_OR_NULL() before attempting to dereference it. I'm not actually entirely sure this fixes the syzbot crash as the kernel config indicates that they do have DEBUG_FS in the kernel, but this is what I found when looking there. Cc: [email protected] Fixes: d82574a ("cfg80211: no need to check return value of debugfs_create functions") Reported-by: [email protected] Reviewed-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/20200525113816.fc4da3ec3d4b.Ica63a110679819eaa9fb3bc1b7437d96b1fd187d@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent d031781 commit 0bbab5f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/wireless/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
142142
if (result)
143143
return result;
144144

145-
if (rdev->wiphy.debugfsdir)
145+
if (!IS_ERR_OR_NULL(rdev->wiphy.debugfsdir))
146146
debugfs_rename(rdev->wiphy.debugfsdir->d_parent,
147147
rdev->wiphy.debugfsdir,
148148
rdev->wiphy.debugfsdir->d_parent, newname);

0 commit comments

Comments
 (0)