Jiri Pirko 5a508a254b 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 "0000:00:10.0" >/sys/bus/pci/drivers/mlxsw_spectrum2/bind
        devlink dev reload pci/0000:00:10.0 &
        echo "0000:00:10.0" >/sys/bus/pci/drivers/mlxsw_spectrum2/unbind
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: 2d8dc5bbf4e7 ("devlink: Add support for reload")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-11-09 19:38:36 -08:00
..
2019-01-23 11:18:00 -08:00
2019-04-19 14:07:40 -07:00
2019-10-23 20:13:22 -07:00
2019-09-13 21:44:19 +02:00
2018-09-13 09:04:58 -07:00
2018-05-16 07:23:35 +02:00
2019-04-22 21:47:25 -07:00
2019-11-06 17:33:32 -08:00
2019-06-19 11:23:13 -04:00
2019-06-19 11:23:13 -04:00