summary refs log tree commit diff
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorMaor Gottlieb <maorg@mellanox.com>2020-05-07 09:29:42 +0300
committerJason Gunthorpe <jgg@mellanox.com>2020-05-12 11:47:48 -0300
commit50bbe3d34fea74b7c0fabe553c40c2f4a48bb9c3 (patch)
treef2d431829198350a0774097355aa3e07ba7b519e /drivers/infiniband
parent1901b91f99821955eac2bd48fe25ee983385dc00 (diff)
downloadlinux-50bbe3d34fea74b7c0fabe553c40c2f4a48bb9c3.tar.gz
RDMA/core: Fix double put of resource
Do not decrease the reference count of resource tracker object twice in
the error flow of res_get_common_doit.

Fixes: c5dfe0ea6ffa ("RDMA/nldev: Add resource tracker doit callback")
Link: https://lore.kernel.org/r/20200507062942.98305-1-leon@kernel.org
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/nldev.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 9eec26d10d7b..e16105be2eb2 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -1292,11 +1292,10 @@ static int res_get_common_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
 	has_cap_net_admin = netlink_capable(skb, CAP_NET_ADMIN);
 
 	ret = fill_func(msg, has_cap_net_admin, res, port);
-
-	rdma_restrack_put(res);
 	if (ret)
 		goto err_free;
 
+	rdma_restrack_put(res);
 	nlmsg_end(msg, nlh);
 	ib_device_put(device);
 	return rdma_nl_unicast(sock_net(skb->sk), msg, NETLINK_CB(skb).portid);