Re: [PATCH] RDMA/cma: fix first byte overwritten for AF_IB

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

 



Hi Sean,

Thanks for looking into this.

I checked nfiniBand TM Architecture Release 1.2.1 VOLUME 1 - GENERAL
SPECIFICATIONS, for RDMA IP CM service,
the private data for CM REQ is defined in:
Table 532 IP Addressing CM REQ Message Private Data Format
So you mean even for RDMA IB, the private data format is also
required, could you point me a little more detail?



On Tue, Dec 16, 2014 at 10:29 PM, Hefty, Sean <sean.hefty@xxxxxxxxx> wrote:
>> 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@xxxxxxxxxxxxxxxx>
>> Signed-off-by: Jack Wang <jinpu.wang@xxxxxxxxxxxxxxxx>
>> ---
>>  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



-- 
Mit freundlichen Grüßen,
Best Regards,

Jack Wang

Linux Kernel Developer Storage
ProfitBricks GmbH  The IaaS-Company.

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin
Tel: +49 30 5770083-42
Fax: +49 30 5770085-98
Email: jinpu.wang@xxxxxxxxxxxxxxxx
URL: http://www.profitbricks.de

Sitz der Gesellschaft: Berlin.
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B.
Geschäftsführer: Andreas Gauger, Achim Weiss.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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