Re: [PATCH for-next] RDMA/rxe: Fix FIXME in rxe_udp_encap_recv()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 28, 2021 at 05:33:19PM -0600, Bob Pearson wrote:
> rxe_udp_encap_recv() drops the reference to rxe->ib_dev taken by
> rxe_get_dev_from_net() which should be held until each received
> skb is freed. This patch moves the calls to ib_device_put() to
> each place a received skb is freed. It also takes references to
> the ib_device for each cloned skb created to process received
> multicast packets.
> 
> Fixes: 4c173f596b3ff ("RDMA/rxe: Use ib_device_get_by_netdev()
>                 instead of open coding")

Do not line wrap fixes lines

> diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
> index c9984a28eecc..8e60d9eaf79a 100644
> --- a/drivers/infiniband/sw/rxe/rxe_recv.c
> +++ b/drivers/infiniband/sw/rxe/rxe_recv.c
> @@ -266,10 +266,19 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
>  		/* 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)
> +		if (mce->qp_list.next != &mcg->qp_list) {
>  			per_qp_skb = skb_clone(skb, GFP_ATOMIC);
> -		else
> +			if (!ib_device_try_get(&rxe->ib_dev)) {
> +				/* shouldn't happen we already have
> +				 * one ref for skb.
> +				 */
> +				pr_warn("ib_device_try_get failed\n");
> +				kfree_skb(per_qp_skb);

I fixed this to just

+                       if (WARN_ON(!ib_device_try_get(&rxe->ib_dev))) {
+                               kfree_skb(per_qp_skb);
+                               continue;
+                       }

> +				continue;
> +			}
> +		} else {
>  			per_qp_skb = skb;
> +		}

And this had a merge collision with the mcast patch, I fixed it up

Applied to for-next, thanks

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux