* [PATCH for-next] rdma_rxe: fixed bug in rxe_rcv_mcast_pkt
@ 2020-10-08 20:36 Bob Pearson
2020-10-08 23:33 ` Jason Gunthorpe
0 siblings, 1 reply; 3+ messages in thread
From: Bob Pearson @ 2020-10-08 20:36 UTC (permalink / raw)
To: jgg, zyjzyj2000, linux-rdma; +Cc: Bob Pearson
- The changes referenced below replaced sbk_clone by
taking additional references, passing the skb along and
then freeing the skb. This deleted the packets before
they could be processed and additionally passed bad data
in each packet. Since pkt is stored in skb->cb
changing pkt->qp changed it for all the packets.
- Replace skb_get by sbk_clone in rxe_rcv_mcast_pkt for
cases where multiple QPs are receiving multicast packets
on the same address.
- Delete kfree_skb because the packets need to live until
they have been processed by each QP. They are freed later.
Signed-off-by: Bob Pearson <rpearson@hpe.com>
Fixes: 86af61764151 ("IB/rxe: remove unnecessary skb_clone")
Fixes: fe896ceb5772 ("IB/rxe: replace refcount_inc with skb_get")
---
drivers/infiniband/sw/rxe/rxe_recv.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
index a9be4efba5f3..6b78e2ff6709 100644
--- a/drivers/infiniband/sw/rxe/rxe_recv.c
+++ b/drivers/infiniband/sw/rxe/rxe_recv.c
@@ -233,6 +233,8 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
struct rxe_mc_elem *mce;
struct rxe_qp *qp;
union ib_gid dgid;
+ struct sk_buff *per_qp_skb;
+ struct rxe_pkt_info *per_qp_pkt;
int err;
if (skb->protocol == htons(ETH_P_IP))
@@ -261,21 +263,26 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
if (err)
continue;
- /* if *not* the last qp in the list
- * increase the users of the skb then post to the next qp
+ /* for all but the last qp create a new clone of the
+ * skb and pass to the qp.
*/
if (mce->qp_list.next != &mcg->qp_list)
- skb_get(skb);
+ per_qp_skb = skb_clone(skb, GFP_ATOMIC);
+ else
+ per_qp_skb = skb;
- pkt->qp = qp;
+ per_qp_pkt = SKB_TO_PKT(per_qp_skb);
+ per_qp_pkt->qp = qp;
rxe_add_ref(qp);
- rxe_rcv_pkt(pkt, skb);
+ rxe_rcv_pkt(per_qp_pkt, per_qp_skb);
}
spin_unlock_bh(&mcg->mcg_lock);
rxe_drop_ref(mcg); /* drop ref from rxe_pool_get_key. */
+ return;
+
err1:
kfree_skb(skb);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH for-next] rdma_rxe: fixed bug in rxe_rcv_mcast_pkt
2020-10-08 20:36 [PATCH for-next] rdma_rxe: fixed bug in rxe_rcv_mcast_pkt Bob Pearson
@ 2020-10-08 23:33 ` Jason Gunthorpe
2020-10-09 17:02 ` Bob Pearson
0 siblings, 1 reply; 3+ messages in thread
From: Jason Gunthorpe @ 2020-10-08 23:33 UTC (permalink / raw)
To: Bob Pearson; +Cc: zyjzyj2000, linux-rdma, Bob Pearson
On Thu, Oct 08, 2020 at 03:36:52PM -0500, Bob Pearson wrote:
> - The changes referenced below replaced sbk_clone by
> taking additional references, passing the skb along and
> then freeing the skb. This deleted the packets before
> they could be processed and additionally passed bad data
> in each packet. Since pkt is stored in skb->cb
> changing pkt->qp changed it for all the packets.
> - Replace skb_get by sbk_clone in rxe_rcv_mcast_pkt for
> cases where multiple QPs are receiving multicast packets
> on the same address.
> - Delete kfree_skb because the packets need to live until
> they have been processed by each QP. They are freed later.
>
> Signed-off-by: Bob Pearson <rpearson@hpe.com>
> Fixes: 86af61764151 ("IB/rxe: remove unnecessary skb_clone")
> Fixes: fe896ceb5772 ("IB/rxe: replace refcount_inc with skb_get")
Fixes lines go before the Signed-off-by
Makes sense to me, applied to for-next
Thanks,
Jasno
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH for-next] rdma_rxe: fixed bug in rxe_rcv_mcast_pkt
2020-10-08 23:33 ` Jason Gunthorpe
@ 2020-10-09 17:02 ` Bob Pearson
0 siblings, 0 replies; 3+ messages in thread
From: Bob Pearson @ 2020-10-09 17:02 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: zyjzyj2000, linux-rdma, Bob Pearson
On 10/8/20 6:33 PM, Jason Gunthorpe wrote:
> On Thu, Oct 08, 2020 at 03:36:52PM -0500, Bob Pearson wrote:
>> - The changes referenced below replaced sbk_clone by
>> taking additional references, passing the skb along and
>> then freeing the skb. This deleted the packets before
>> they could be processed and additionally passed bad data
>> in each packet. Since pkt is stored in skb->cb
>> changing pkt->qp changed it for all the packets.
>> - Replace skb_get by sbk_clone in rxe_rcv_mcast_pkt for
>> cases where multiple QPs are receiving multicast packets
>> on the same address.
>> - Delete kfree_skb because the packets need to live until
>> they have been processed by each QP. They are freed later.
>>
>> Signed-off-by: Bob Pearson <rpearson@hpe.com>
>> Fixes: 86af61764151 ("IB/rxe: remove unnecessary skb_clone")
>> Fixes: fe896ceb5772 ("IB/rxe: replace refcount_inc with skb_get")
>
> Fixes lines go before the Signed-off-by
>
> Makes sense to me, applied to for-next
>
> Thanks,
> Jasno
>
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-09 17:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08 20:36 [PATCH for-next] rdma_rxe: fixed bug in rxe_rcv_mcast_pkt Bob Pearson
2020-10-08 23:33 ` Jason Gunthorpe
2020-10-09 17:02 ` Bob Pearson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).