IB/mlx4: Fix bug unwinding on error in mlx4_ib_init_sriov()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 4 Feb 2013 11:22:36 +0000 (11:22 +0000)
committerRoland Dreier <roland@purestorage.com>
Fri, 15 Feb 2013 23:22:26 +0000 (15:22 -0800)
commitcab66d1273e6490603cf5256155584d38cecca68
tree3c698a4645dd873c0f4ac025b4a4ccb005b3f1af
parent836dc9e3fbbab0c30aa6e664417225f5c1fb1c39
IB/mlx4: Fix bug unwinding on error in mlx4_ib_init_sriov()

We have to decrement "i" before calling mlx4_ib_free_demux_ctx() or we
free something that wasn't allocated.  That's fine for free_pv_object()
but it would lead to a NULL dereference calling mlx4_ib_free_demux_ctx().
The null dereference is because ->tun is NULL when we check:

if (!ctx->tun[i])

Also we didn't free ->sriov.demux[0] so it was a small leak.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/mlx4/mad.c