RDMA/cma: Make sure that PSN is not over max allowed
authorMoni Shoua <monis@mellanox.com>
Sun, 26 Nov 2017 18:23:54 +0000 (20:23 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 1 Dec 2017 19:21:26 +0000 (12:21 -0700)
This patch limits the initial value for PSN to 24 bits as
spec requires.

Signed-off-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/cma.c

index 1fdb473b5df7be38c09ecd49121d516b4893ef13..f6983357145de1adeedd2d8a1bb0401a848b34c0 100644 (file)
@@ -801,6 +801,7 @@ struct rdma_cm_id *rdma_create_id(struct net *net,
        INIT_LIST_HEAD(&id_priv->mc_list);
        get_random_bytes(&id_priv->seq_num, sizeof id_priv->seq_num);
        id_priv->id.route.addr.dev_addr.net = get_net(net);
+       id_priv->seq_num &= 0x00ffffff;
 
        return &id_priv->id;
 }