OSDN Git Service

mac80211_hwsim: fix race in radio destruction from netlink notifier
authorMartin Willi <martin@strongswan.org>
Tue, 25 Sep 2018 07:41:14 +0000 (09:41 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 26 Sep 2018 09:20:41 +0000 (11:20 +0200)
commitf1c47eb61d52379de5747d02bb36be20d7a2d0d3
treec73fa0c8a654090d36521255670366498999ddd6
parent628980e5c8f038f730582c6ee50b7410741cd96e
mac80211_hwsim: fix race in radio destruction from netlink notifier

The asynchronous destruction from a work-queue of radios tagged with
destroy-on-close may race with the owning namespace about to exit,
resulting in potential use-after-free of that namespace.

Instead of using a work-queue, move radios about to destroy to a
temporary list, which can be worked on synchronously after releasing
the lock. This should be safe to do from the netlink socket notifier,
as the namespace is guaranteed to not get released.

Signed-off-by: Martin Willi <martin@strongswan.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/mac80211_hwsim.c