Re: [PATCH for-4.11 2/2] cfg80211: check rdev resume callback only for registered wiphy
From: Johannes Berg <johannes@sipsolutions.net>
Date: 2017-03-29 06:34:36
From: Johannes Berg <johannes@sipsolutions.net>
Date: 2017-03-29 06:34:36
On Tue, 2017-03-28 at 16:46 +0200, Arend Van Spriel wrote:
On 28-3-2017 16:25, Johannes Berg wrote:quoted
quoted
quoted
quoted
- 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.Oh, right. Looks like I misinterpreted things.So apparently my choice of words was poor. Do you want me to rephrase?
Nah, don't worry. When I apply it I'll re-read and see if I just confused myself or if it makes sense to reword a bit. johannes