diff mbox

RDMA/cma: fix first byte overwritten for AF_IB

Message ID CAMGffEno_VWBKkfCxggu9n94qBWULH=dj3AHyvWN_SH2CH8wBQ@mail.gmail.com (mailing list archive)
State Rejected
Headers show

Commit Message

Jinpu Wang Dec. 16, 2014, 2:55 p.m. UTC
commit 56e620c453f2588cfc9898a41b110477f6417a5d
Author: Jack Wang <jinpu.wang@profitbricks.com>
Date:   Tue Dec 16 15:44:17 2014 +0100

    RDMA/cma: fix first byte overwritten for AF_IB

    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@profitbricks.com>
    Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>


@@ -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);
diff mbox

Patch

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);