This is racy, unless caller already owns a lock.
If caller aleady owns a lock, you dont need :
rcu_read_lock()
list_for_each_entry_rcu()
rcu_read_unlock();
Its not clear that you use trace_state_lock as the lock guarding all this.
If this is the case I suggest a plain and straight forward :
case NETDEV_UNREGISTER:
spin_lock(&trace_state_lock);
if (trace_state == TRACE_OFF) {
list_for_each_entry(new_stat, &hw_stats_list, list) {
if (new_stat->dev == dev) {
new_stat->dev = NULL;
list_del_rcu(&new_stat->list);
call_rcu(&new_stat->rcu, free_dm_hw_stat);
break;
}
}
}
spin_unlock(&trace_state_lock);
break;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html