Re: [PATCH] wifi: cfg80211: avoid holding rtnl_mutex across all cfg80211_leave() calls

From: Johannes Berg

Date: Sun Sep 06 2026 - 07:58:12 EST


On Sun, 2026-09-06 at 03:25 +0300, Ömer Mete Kaya wrote:
>
> + /*
> + * Snapshot rdev pointers under RCU with a device reference so they
> + * cannot be freed between per-device rtnl acquisitions. Using a
> + * per-device rtnl_lock() instead of holding it across all devices
> + * avoids starving other rtnl waiters when cfg80211_leave() is slow.
> + */
> + rcu_read_lock();
> + list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list)
> + n++;
> + rcu_read_unlock();
>
> - rtnl_unlock();
> + if (!n)
> + return;
> +
> + snap = kmalloc_array(n, sizeof(*snap), GFP_KERNEL);
> + if (!snap)
> + return;

I really don't know _what_ you're doing here, or more realistically what
exactly you're asking your LLM to do here, but it's pointless. Please
just stop, you're not helping in any way.

johannes