]> git.baikalelectronics.ru Git - kernel.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)
commita44e2991765b7f5a726197ea209786197a3d8525
tree22374e70f03a2ac674e190e0a7cf1ae928889579
parent75aca73c7046f92796449345d1ce830e7c999e8b
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