Skip to contentSkip to conversation

RDMA/core: Fix double put of resource

PATCH Applied Leon Romanovsky 2 participants 2 messages May 7, 2020 – May 12, 2020 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/core: Fix double put of resource

From: Maor Gottlieb <[email protected]>

Avoid decrease reference count of resource tracker object in the error flow of res_get_common_doit.

Fixes c5dfe0ea6ffa ("RDMA/nldev: Add resource tracker doit callback")
---
 drivers/infiniband/core/nldev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/core/nldev.c +1 -2
index 9eec26d10d7b..e16105be2eb2 100644
@@ -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);
Signature · 1 line
2.26.2
#1 lore raw
Quoted 11 lines · Leon Romanovsky

From: Maor Gottlieb <[email protected]>

Avoid decrease reference count of resource tracker object in the error flow of res_get_common_doit.

Fixes c5dfe0ea6ffa ("RDMA/nldev: Add resource tracker doit callback")
---
 drivers/infiniband/core/nldev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Applied to for-rc, thanks

Jason