IB/mlx4: Fix shutdown crash accessing a non-existent bitmap
authorRoland Dreier <roland@purestorage.com>
Tue, 6 Dec 2011 18:47:37 +0000 (10:47 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 6 Jan 2012 22:17:01 +0000 (14:17 -0800)
commit8b6984422659dd49fdbf9ef3c829bd2bb3798053
tree21ce91055494b5b33046ae9e44aed311885803d6
parent2c141bbe1ddfb7f91749af4411f884125ea6e14e
IB/mlx4: Fix shutdown crash accessing a non-existent bitmap

commit 4af3ce0de0c12e5c17811eaefad36ab8e146c0fd upstream.

Commit cfcde11c3d7a ("IB/mlx4: Use flow counters on IBoE ports") added
code that sets elements of counters[] to -1 if no counter is allocated,
but then goes ahead and passes every entry to mlx4_counter_free() on
shutdown.  This is a bad idea, especially if MLX4_DEV_CAP_FLAG_COUNTERS
isn't set so there isn't even an underlying bitmap to free from.

Tested-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/infiniband/hw/mlx4/main.c