<Ajay.Kathat@xxxxxxxxxxxxx> writes: >>> @@ -781,13 +776,15 @@ static int wilc_mac_close(struct net_device *ndev) >>> if (vif->ndev) { >>> netif_stop_queue(vif->ndev); >>> >>> + if (wl->open_ifcs == 0) >>> + wl->close = 1; >>> + >> >> wl-close is an int, I wonder if it's racy to int as a flag like this? In >> cases like this I usually use set_bit() & co because those guarantee >> atomicity, though don't know if that's overkill. >> > > I think it's a good idea to use an atomic operation but I am not sure if > using atomic for 'wl->close' will have much impact. For instance, if any > new work gets added to the workqueue before the 'wl->close=1' is fully > completed, then that work would get executed as normal. Sure, this is most likely a small race condition. But still a race. > However, I feel it's safe to define 'wl->close' as atomic_t type. I will > prepare the conversion patch and will try to include it along with the > updated version of this patch. Why atomic_t? You only use values 0 and 1 so test_bit() and set_bit() sounds more approriate to me. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches