linux_dsm_epyc7002/drivers/net/netdevsim
Jiri Pirko a0c76345e3 devlink: disallow reload operation during device cleanup
There is a race between driver code that does setup/cleanup of device
and devlink reload operation that in some drivers works with the same
code. Use after free could we easily obtained by running:

while true; do
        echo 10 > /sys/bus/netdevsim/new_device
        devlink dev reload netdevsim/netdevsim10 &
        echo 10 > /sys/bus/netdevsim/del_device
done

Fix this by enabling reload only after setup of device is complete and
disabling it at the beginning of the cleanup process.

Reported-by: Ido Schimmel <idosch@mellanox.com>
Fixes: 2d8dc5bbf4 ("devlink: Add support for reload")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-11-08 14:11:47 -08:00
..
bpf.c netdevsim: move netdev creation/destruction to dev probe 2019-04-26 01:52:03 -04:00
bus.c netdevsim: create devlink and netdev instances in namespace 2019-10-05 16:34:15 -07:00
dev.c devlink: disallow reload operation during device cleanup 2019-11-08 14:11:47 -08:00
fib.c netdevsim: Fix error handling in nsim_fib_init and nsim_fib_exit 2019-10-13 11:30:14 -07:00
health.c netdevsim: implement couple of testing devlink health reporters 2019-10-11 21:02:30 -07:00
ipsec.c netdevsim: move netdev creation/destruction to dev probe 2019-04-26 01:52:03 -04:00
Makefile netdevsim: implement couple of testing devlink health reporters 2019-10-11 21:02:30 -07:00
netdev.c netdevsim: register port netdevices into net of device 2019-10-04 11:10:56 -07:00
netdevsim.h netdevsim: implement couple of testing devlink health reporters 2019-10-11 21:02:30 -07:00
sdev.c netdevsim: move shared dev creation and destruction into separate file 2019-04-12 16:49:54 -07:00