All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hefty, Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Jack Wang <jinpu.wang-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>,
	"roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: "linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: RE: [PATCH] RDMA/cma: fix first byte overwritten for AF_IB
Date: Tue, 16 Dec 2014 21:29:52 +0000	[thread overview]
Message-ID: <1828884A29C6694DAF28B7E6B8A8237399E2DE69@ORSMSX110.amr.corp.intel.com> (raw)
In-Reply-To: <1418744596-25251-1-git-send-email-jinpu.wang-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>

> If user attach private data for AF_IB, the first byte will
> be overwritten, because we always set the cma version no matter
> family is AF_IB, so move the version set inside if condition.
> 
> Reported-by: Fabian Holler <fabian.holler-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
> Signed-off-by: Jack Wang <jinpu.wang-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
> ---
>  drivers/infiniband/core/cma.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
> index d570030..22a22e2 100644
> --- a/drivers/infiniband/core/cma.c
> +++ b/drivers/infiniband/core/cma.c
> @@ -2618,10 +2618,10 @@ static int cma_format_hdr(void *hdr, struct
> rdma_id_private *id_priv)
>  	struct cma_hdr *cma_hdr;
> 
>  	cma_hdr = hdr;
> -	cma_hdr->cma_version = CMA_VERSION;
>  	if (cma_family(id_priv) == AF_INET) {
>  		struct sockaddr_in *src4, *dst4;
> 
> +		cma_hdr->cma_version = CMA_VERSION;
>  		src4 = (struct sockaddr_in *) cma_src_addr(id_priv);
>  		dst4 = (struct sockaddr_in *) cma_dst_addr(id_priv);
> 
> @@ -2632,6 +2632,7 @@ static int cma_format_hdr(void *hdr, struct
> rdma_id_private *id_priv)
>  	} else if (cma_family(id_priv) == AF_INET6) {
>  		struct sockaddr_in6 *src6, *dst6;
> 
> +		cma_hdr->cma_version = CMA_VERSION;
>  		src6 = (struct sockaddr_in6 *) cma_src_addr(id_priv);
>  		dst6 = (struct sockaddr_in6 *) cma_dst_addr(id_priv);

I don't think this is sufficient.  The RDMA CM private data header is defined by the IB spec.  If the service ID starts with the prefix 0x0000000001, it's reasonable to assume that the header is part of the private data.  The receive side should probably even check the version and discard any unknown values.

- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-12-16 21:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16 15:43 [PATCH] RDMA/cma: fix first byte overwritten for AF_IB Jack Wang
     [not found] ` <1418744596-25251-1-git-send-email-jinpu.wang-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2014-12-16 21:29   ` Hefty, Sean [this message]
     [not found]     ` <1828884A29C6694DAF28B7E6B8A8237399E2DE69-8oqHQFITsIHTXloPLtfHfbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-12-17 10:02       ` Jinpu Wang
     [not found]         ` <CAMGffEn9cxNqv48Vyv_TSB5yO7CgGLDHGjVJBRTihPw0v=EJhw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-17 17:58           ` Hefty, Sean
     [not found]             ` <1828884A29C6694DAF28B7E6B8A8237399E30341-8oqHQFITsIHTXloPLtfHfbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-12-18  9:13               ` Jinpu Wang
     [not found]                 ` <CAMGffEktJGzk4FyLh85UAu2Y1998OZJ_p8=-6rzsQ28-KwEDzA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-18 18:21                   ` Hefty, Sean
2014-12-17 10:40   ` Or Gerlitz
     [not found]     ` <54915D84.5000405-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-12-17 11:58       ` Jinpu Wang
  -- strict thread matches above, loose matches on Subject: below --
2014-12-16 14:55 [PATCH]RDMA/cma: " Jinpu Wang

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=1828884A29C6694DAF28B7E6B8A8237399E2DE69@ORSMSX110.amr.corp.intel.com \
    --to=sean.hefty-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=jinpu.wang-EIkl63zCoXaH+58JC4qpiA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /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.