IB/core: Unregister notifier before freeing MAD security
commitd60667fc39
upstream. If the notifier runs after the security context is freed an access of freed memory can occur. Fixes:47a2b338fe
("IB/core: Enforce security on management datagrams") Signed-off-by: Daniel Jurgens <danielj@mellanox.com> Reviewed-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0d7ae54867
commit
2fecdc27f5
@ -732,9 +732,10 @@ void ib_mad_agent_security_cleanup(struct ib_mad_agent *agent)
|
|||||||
if (!rdma_protocol_ib(agent->device, agent->port_num))
|
if (!rdma_protocol_ib(agent->device, agent->port_num))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
security_ib_free_security(agent->security);
|
|
||||||
if (agent->lsm_nb_reg)
|
if (agent->lsm_nb_reg)
|
||||||
unregister_lsm_notifier(&agent->lsm_nb);
|
unregister_lsm_notifier(&agent->lsm_nb);
|
||||||
|
|
||||||
|
security_ib_free_security(agent->security);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ib_mad_enforce_security(struct ib_mad_agent_private *map, u16 pkey_index)
|
int ib_mad_enforce_security(struct ib_mad_agent_private *map, u16 pkey_index)
|
||||||
|
Reference in New Issue
Block a user