All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Bob Pearson <rpearsonhpe@gmail.com>
Cc: <zyjzyj2000@gmail.com>, <linux-rdma@vger.kernel.org>,
	Bob Pearson <rpearson@hpe.com>
Subject: Re: [PATCH for-next] RDMA/rxe: Fix FIXME in rxe_udp_encap_recv()
Date: Fri, 5 Feb 2021 13:59:08 -0400	[thread overview]
Message-ID: <20210205175908.GE968475@nvidia.com> (raw)
In-Reply-To: <20210128233318.2591-1-rpearson@hpe.com>

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

      reply	other threads:[~2021-02-05 18:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28 23:33 [PATCH for-next] RDMA/rxe: Fix FIXME in rxe_udp_encap_recv() Bob Pearson
2021-02-05 17:59 ` Jason Gunthorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210205175908.GE968475@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rpearson@hpe.com \
    --cc=rpearsonhpe@gmail.com \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.