RDMA/srpt: Fix disabling device management
authorKamal Heib <kamalheib1@gmail.com>
Thu, 14 May 2020 11:47:20 +0000 (14:47 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:48:24 +0000 (17:48 +0200)
commit4b08481a2162dfbda4d41382e383f6c624cb8673
treec1b11f49c93b9f6d932cf743e218d13089ce4488
parent645943ecaa58775582ffef6ae48efdda835af2ff
RDMA/srpt: Fix disabling device management

[ Upstream commit 23bbd5818e2b0d265aa1835e66f5055f63a8fa4c ]

Avoid disabling device management for devices that don't support
Management datagrams (MADs) by checking if the "mad_agent" pointer is
initialized before calling ib_modify_port, also fix the error flow in
srpt_refresh_port() to disable device management if
ib_register_mad_agent() fail.

Fixes: 09f8a1486dca ("RDMA/srpt: Fix handling of SR-IOV and iWARP ports")
Link: https://lore.kernel.org/r/20200514114720.141139-1-kamalheib1@gmail.com
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/ulp/srpt/ib_srpt.c