On 28-3-2017 14:34, Johannes Berg wrote: >> Changing the checks in >> wiphy_resume() to only access the struct >> cfg80211_registered_device::ops >> when the wiphy instance is registered. > > [...] > >> +++ b/net/wireless/sysfs.c >> @@ -132,12 +132,10 @@ static int wiphy_resume(struct device *dev) >> /* Age scan results with time spent in suspend */ >> cfg80211_bss_age(rdev, get_seconds() - rdev->suspend_at); >> >> - if (rdev->ops->resume) { >> - rtnl_lock(); >> - if (rdev->wiphy.registered) >> - ret = rdev_resume(rdev); >> - rtnl_unlock(); >> - } >> + rtnl_lock(); >> + if (rdev->wiphy.registered && rdev->ops->resume) >> + ret = rdev_resume(rdev); >> + rtnl_unlock(); > > Hmm? Commit message seems ... old perhaps? Hmmm, why? Before the patch rdev->ops was accessed before checking rdev->wiphy.registered. When rdev->wiphy.registers is false we no longer access rdev->ops after the patch. So a driver doing a wiphy_unregister() can safely kfree() the callback struct after it. Regards, Arend