Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Maor Gottlieb and committed by
Jason Gunthorpe
50bbe3d3 1901b91f

+1 -2
+1 -2
drivers/infiniband/core/nldev.c
··· 1292 1292 has_cap_net_admin = netlink_capable(skb, CAP_NET_ADMIN); 1293 1293 1294 1294 ret = fill_func(msg, has_cap_net_admin, res, port); 1295 - 1296 - rdma_restrack_put(res); 1297 1295 if (ret) 1298 1296 goto err_free; 1299 1297 1298 + rdma_restrack_put(res); 1300 1299 nlmsg_end(msg, nlh); 1301 1300 ib_device_put(device); 1302 1301 return rdma_nl_unicast(sock_net(skb->sk), msg, NETLINK_CB(skb).portid);