On Sun, Feb 14, 2021 at 04:26:31PM -0600, Bob Pearson wrote: > Three errors occurred in the fix referenced below. > > 1) The on and off again 'if (skb)' got dropped but was really > needed in rxe_rcv_mcast_pkt() to prevent calling ib_device_put() > on the non-error path. > > 2) Extending the reference taken by rxe_get_dev_from_net() in > rxe_udp_encap_recv() until each skb is freed was not matched by > a reference in the loopback path resulting in underflows. > > 3) In rxe_comp.c the function free_pkt() did not clear skb which > triggered a warning at done: and could possibly at exit: in > rxe_completer(). The WARN_ONCE() calls are not required at done: > and only in one place before going to exit. > > This patch fixes these errors. > > Fixes: 899aba891cab ("RDMA/rxe: Fix FIXME in rxe_udp_encap_recv()") > Signed-off-by: Bob Pearson <rpearson@xxxxxxx> > --- > drivers/infiniband/sw/rxe/rxe_comp.c | 5 +++-- > drivers/infiniband/sw/rxe/rxe_net.c | 7 ++++++- > drivers/infiniband/sw/rxe/rxe_recv.c | 6 ++++-- > 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c index 8a48a33d587b..29cb0125e76f 100644 --- a/drivers/infiniband/sw/rxe/rxe_recv.c +++ b/drivers/infiniband/sw/rxe/rxe_recv.c @@ -247,6 +247,11 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) else if (skb->protocol == htons(ETH_P_IPV6)) memcpy(&dgid, &ipv6_hdr(skb)->daddr, sizeof(dgid)); + if (!ib_device_try_get(&rxe->ib_dev)) { + kfree_skb(skb); + return; + } + /* lookup mcast group corresponding to mgid, takes a ref */ mcg = rxe_pool_get_key(&rxe->mc_grp_pool, &dgid); if (!mcg) @@ -274,10 +279,6 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) */ if (mce->qp_list.next != &mcg->qp_list) { per_qp_skb = skb_clone(skb, GFP_ATOMIC); - if (WARN_ON(!ib_device_try_get(&rxe->ib_dev))) { - kfree_skb(per_qp_skb); - continue; - } } else { per_qp_skb = skb; /* show we have consumed the skb */