net/mlx4: fix crash when configure is not called
authorYongseok Koh <yskoh@mellanox.com>
Sun, 27 May 2018 07:04:55 +0000 (00:04 -0700)
committerShahaf Shuler <shahafs@mellanox.com>
Mon, 28 May 2018 14:35:05 +0000 (16:35 +0200)
commit4423d4a112e29b5db48c2be349c9b3a5e245ca51
treec378b23fbe34104c2f569f6cd08af0351df236d8
parent0ace586dee70ce1842c858e27a3590417f8fb40c
net/mlx4: fix crash when configure is not called

Although uncommon, applications may destroy a device immediately after
probing it without going through dev_configure() first.

This patch addresses a crash which occurs when mlx4_dev_close() calls
mlx4_mr_release() due to an uninitialized entry in the private structure.

In addition MR cache init takes place on the device configuration.
When the device is re-configured multiple times, for example when
changing the number of queue on the flight, deadlock can happen.

This patch moved MR cache init from device configuration function to
probe function to make sure init only once.

Fixes: 9797bfcce1c9 ("net/mlx4: add new memory region support")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
drivers/net/mlx4/mlx4.c