History

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.

Johannes Berg committed 6 years ago

Commit 0bbab5f1 parent d0317811 file · +1 −1Browse files

Unified · Split

net/wireless/core.c+1−1
@@ -142,7 +142,7 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, · 141 unmodified lines
142 if (result)142 if (result)
143 return result;143 return result;
144 144
145 if (rdev->wiphy.debugfsdir)145 if (!IS_ERR_OR_NULL(rdev->wiphy.debugfsdir))
146 debugfs_rename(rdev->wiphy.debugfsdir->d_parent,146 debugfs_rename(rdev->wiphy.debugfsdir->d_parent,
147 rdev->wiphy.debugfsdir,147 rdev->wiphy.debugfsdir,
148 rdev->wiphy.debugfsdir->d_parent, newname);148 rdev->wiphy.debugfsdir->d_parent, newname);