IB/mlx4: Fix memory leaks
authorWenwen Wang <wenwen@cs.uga.edu>
Sun, 18 Aug 2019 20:23:01 +0000 (15:23 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Sep 2019 09:33:50 +0000 (10:33 +0100)
commitadb87027b5ffca112f99284fe808fe60e0e6d1c5
tree25d7d01ee6133b9229167782498e1a1a9f600e64
parent5e416b11b4a941040ee04a5f2883df3980a3f733
IB/mlx4: Fix memory leaks

[ Upstream commit 5c1baaa82cea2c815a5180ded402a7cd455d1810 ]

In mlx4_ib_alloc_pv_bufs(), 'tun_qp->tx_ring' is allocated through
kcalloc(). However, it is not always deallocated in the following execution
if an error occurs, leading to memory leaks. To fix this issue, free
'tun_qp->tx_ring' whenever an error occurs.

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Acked-by: Leon Romanovsky <leonro@mellanox.com>
Link: https://lore.kernel.org/r/1566159781-4642-1-git-send-email-wenwen@cs.uga.edu
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/mlx4/mad.c