Re: [PATCH] wifi: nl80211: serialize socket owner release with netdev teardown

From: Johannes Berg

Date: Mon Jul 06 2026 - 10:55:36 EST


On Mon, 2026-07-06 at 20:24 +0800, Cen Zhang wrote:
> Hi Johannes,
>
> Thanks for your review and comments.
>
> > What's that supposed to mean? Of course there's ordering between those
> > two things?
>
> You're right, that wording was imprecise.
>
> I didn't mean that NETDEV_GOING_DOWN and NETDEV_UNREGISTER are unordered with
> respect to each other. What I meant is that the NETLINK_URELEASE notifier's
> schedule_work() site is not ordered against the teardown-side
> cancel_work_sync() for the same wdev.

Yeah, fair.

> I chose RTNL because netdev notifier delivery is already serialized by RTNL,
> so it orders the existing schedule_work() producer against the existing
> cancel_work_sync() with a small change. But if you prefer moving the cancel,
> I can rework v2 in that direction.
>
> My only concern with simply moving a final cancel into
> _cfg80211_unregister_wdev() is that this path is called with the wiphy mutex
> held, while cfg80211_autodisconnect_wk() also takes the wiphy mutex. So I
> think the final drain would need to happen after the RCU readers are gone,
> but outside the wiphy lock and before the wdev/netdev lifetime can end.

Sounds like maybe it should just be a wiphy work so we don't have to
worry about the locking at all?

johannes