]> git.baikalelectronics.ru Git - kernel.git/commit
net: mvneta: Fix race condition during stopping
authorGregory CLEMENT <gregory.clement@free-electrons.com>
Thu, 4 Feb 2016 21:09:29 +0000 (22:09 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Feb 2016 11:02:19 +0000 (06:02 -0500)
commitf90428ee403b3898c225bef2a37f7bb0bc2ff98c
tree65698e251a6ed799f6414a32f1f172b5fabab0b2
parent4a677caab16cf066342f81b2fd7d620562b5edd0
net: mvneta: Fix race condition during stopping

When stopping the port, the CPU notifier are still there whereas the
mvneta_stop_dev function calls mvneta_percpu_disable() on each CPUs.
It was possible to have a new CPU coming at this point which could be
racy.

This patch adds a flag preventing executing the code notifier for a new
CPU when the port is stopping. It also uses the spinlock introduces
previously. To avoid the deadlock, the lock has been moved outside the
mvneta_percpu_elect function.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvneta.c