On Wed, Oct 28, 2020 at 08:50:51AM +0200, Leon Romanovsky wrote: > From: Maor Gottlieb <maorg@xxxxxxxxxx> > > Failure in srpt_refresh_port() for the second port will leave MAD > registered for the first one, however, the srpt_add_one() will be > marked as "failed" and SRPT will leak resources for that registered > but not used and released first port. > > Unregister the MAD agent for all ports in case of failure. > > Fixes: a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1") > Signed-off-by: Maor Gottlieb <maorg@xxxxxxxxxx> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx> > Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx> > --- > Changelog: > v2: > * Added an extra parameter to srpt_unregister_mad_agent() to eliminate > an extra obfuscation call. > v1: > https://lore.kernel.org/linux-rdma/20201027055920.1760663-1-leon@xxxxxxxxxx > * Fixed and updated commit message. > * Remove port_cnt check from __srpt_unregister_mad_agent(). > v0: > https://lore.kernel.org/linux-rdma/20201026132737.1338171-1-leon@xxxxxxxxxx > --- > drivers/infiniband/ulp/srpt/ib_srpt.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) Applied to for-rc, thanks Jason