]> asedeno.scripts.mit.edu Git - linux.git/commit
mac80211_hwsim: Make hwsim_netgroup IDA
authorKirill Tkhai <ktkhai@virtuozzo.com>
Thu, 1 Mar 2018 11:30:09 +0000 (14:30 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 2 Mar 2018 08:59:58 +0000 (09:59 +0100)
commit03695549aa76e877d596df188c266f06257b6a23
tree22374e70f03a2ac674e190e0a7cf1ae928889579
parent24bba078eca099b5bd25e17e97b485f013589f8c
mac80211_hwsim: Make hwsim_netgroup IDA

hwsim_netgroup counter is declarated as int, and it is incremented
every time a new net is created. After sizeof(int) net are created,
it will overflow, and different net namespaces will have the same
identifier. This patch fixes the problem by introducing IDA instead
of int counter. IDA guarantees, all the net namespaces have the uniq
identifier.

Note, that after we do ida_simple_remove() in hwsim_exit_net(),
and we destroy the ID, later there may be executed destroy_radio()
from the workqueue. But destroy_radio() does not use the ID, so it's OK.

Out of bounds of this patch, just as a report to wireless subsystem
maintainer, destroy_radio() increaments hwsim_radios_generation
without hwsim_radio_lock, so this may need one more patch to fix.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/mac80211_hwsim.c