Skip to content

Commit 8776618

Browse files
Bob Pearsonjgunthorpe
authored andcommitted
RDMA/rxe: Fix incorrect rxe_put in error path
In rxe_send() a ref is taken on the qp to keep it alive until the kfree_skb() has a chance to call the skb destructor rxe_skb_tx_dtor() which drops the reference. If the packet has an incorrect protocol the error path just calls kfree_skb() which will call the destructor which will drop the ref. Currently the driver also calls rxe_put() which is incorrect. Additionally since the packets sent to rxe_send() are under the control of the driver and it only ever produces IPV4 or IPV6 packets the simplest fix is to remove all the code in this block. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bob Pearson <[email protected]> Fixes: 9eb7f8e ("IB/rxe: Move refcounting earlier in rxe_send()") Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 23bc06a commit 8776618

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

drivers/infiniband/sw/rxe/rxe_net.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -366,18 +366,10 @@ static int rxe_send(struct sk_buff *skb, struct rxe_pkt_info *pkt)
366366
rxe_get(pkt->qp);
367367
atomic_inc(&pkt->qp->skb_out);
368368

369-
if (skb->protocol == htons(ETH_P_IP)) {
369+
if (skb->protocol == htons(ETH_P_IP))
370370
err = ip_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb);
371-
} else if (skb->protocol == htons(ETH_P_IPV6)) {
371+
else
372372
err = ip6_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb);
373-
} else {
374-
rxe_dbg_qp(pkt->qp, "Unknown layer 3 protocol: %d\n",
375-
skb->protocol);
376-
atomic_dec(&pkt->qp->skb_out);
377-
rxe_put(pkt->qp);
378-
kfree_skb(skb);
379-
return -EINVAL;
380-
}
381373

382374
if (unlikely(net_xmit_eval(err))) {
383375
rxe_dbg_qp(pkt->qp, "error sending packet: %d\n", err);

0 commit comments

Comments
 (0)