net/mlx4_core: Fix potential kernel Oops in res tracker during Dom0 driver unload
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Tue, 15 May 2012 10:35:02 +0000 (10:35 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 May 2012 04:56:58 +0000 (00:56 -0400)
commitb8924951f633a0bb78972ef583d58ca8c26d8e73
treef6be7601a92a408ae78aa18bea863d6f82a0e56c
parent681372a7a37d4226261e2be2faf3aec5b9e022c2
net/mlx4_core: Fix potential kernel Oops in res tracker during Dom0 driver unload

Currently the slave and master resources are deleted after master freed
all bitmaps. If any resources were not properly cleaned up during the
shutdown process, an Oops would result.

Fix so that delete slave (only) resources during cleanup. Master resources
are cleaned up during unload process, and need not separately be cleaned.

Note that during cleanup, we need to split the resource-tracker freeing
functionality.

Before removing all the bitmaps, we free any leftover slave resources.
However, we can only remove the resource tracker linked list after
all bitmap frees, since some of the freeing functions (e.g.,
mlx4_cleanup_eq_table) use paravirtualized FW commands which expect
the resource tracker linked list to be present.

Found-by: Aviad Yehezkel <aviadye@mellanox.com>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/cmd.c
drivers/net/ethernet/mellanox/mlx4/main.c
drivers/net/ethernet/mellanox/mlx4/mlx4.h
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c