RDMA/cxgb4: Fix neigh reference leak in rx_pkt()
Subsystems (3)
PATCH 3/5 RDMA/cxgb4: Fix neigh reference leak in rx_pkt()
If ip_dev_find() fails on the loopback path the code jumps to free_dst without releasing the neighbour reference taken by dst_neigh_lookup_skb(), leaking one neigh reference.
Release the neighbour before jumping to free_dst.
Fixes ef42520240aa ("RDMA/cxgb4: add null-ptr-check after ip_dev_find()")
Signed-off-by Wentao Liang <[email protected]>
--- drivers/infiniband/hw/cxgb4/cm.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/cxgb4/cm.c +1 -0
@@ -4156,6 +4156,7 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) pdev =ip_dev_find (&init_net, iph->daddr);if (!pdev) {pr_err ("%s - failed to find device!\n" , __func__); +neigh_release (neigh); goto free_dst; } e = cxgb4_l2t_get(dev->rdev.lldi.l2t, neigh,
Signature · 1 line
2.34.1
Leon Romanovsky
AppliedQuoted 8 lines · Wentao Liang
If
ip_dev_find()fails on the loopback path the code jumps tofree_dstwithout releasing the neighbour reference taken bydst_neigh_lookup_skb(), leaking one neigh reference.Release the neighbour before jumping to
free_dst.[...]
Applied, thanks!
[3/5] RDMA/cxgb4: Fix neigh reference leak in rx_pkt()
https://git.kernel.org/rdma/rdma/c/5fb3051aa4611a
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>