IB/cma: cma_match_net_dev needs to take into account port_num
authorMatan Barak <matanb@mellanox.com>
Mon, 21 Dec 2015 15:01:24 +0000 (17:01 +0200)
committerDoug Ledford <dledford@redhat.com>
Wed, 23 Dec 2015 04:22:50 +0000 (23:22 -0500)
commitfac51590c1a077809984139e9bb9e06ed366f219
treeeeec07c777beba0743798ba1951df9c70092da17
parentab5cdc31630c7596d81ca8fbe7d695f10666f39b
IB/cma: cma_match_net_dev needs to take into account port_num

Previously, cma_match_net_dev called cma_protocol_roce which
tried to verify that the IB device uses RoCE protocol. However,
if rdma_id wasn't bound to a port, then the check would occur
against the first port of the device without regard to whether
that port was even of the same type as the type of port the
incoming packet was received on.

Fix this by passing the port of the request and only checking
against the same port of the device.

Reported-by: Or Gerlitz <gerlitz.or@gmail.com>
Fixes: b8cab5dab15f ('IB/cma: Accept connection without a valid netdev on RoCE')
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/cma.c