diff options
author | Daniel Jurgens <danielj@mellanox.com> | 2019-02-02 11:09:42 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-08 07:20:52 +0200 |
commit | 2fecdc27f5cdbf97c6f7a10bfc45e620182fc10c (patch) | |
tree | bdbb93ceae25a2a07d90d0dbcdac66403a91cf99 | |
parent | 0d7ae54867f917d4f3b50508e036002051410b6b (diff) | |
download | linux-stable-2fecdc27f5cdbf97c6f7a10bfc45e620182fc10c.tar.gz linux-stable-2fecdc27f5cdbf97c6f7a10bfc45e620182fc10c.tar.bz2 linux-stable-2fecdc27f5cdbf97c6f7a10bfc45e620182fc10c.zip |
IB/core: Unregister notifier before freeing MAD security
commit d60667fc398ed34b3c7456b020481c55c760e503 upstream.
If the notifier runs after the security context is freed an access of
freed memory can occur.
Fixes: 47a2b338fe63 ("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>
-rw-r--r-- | drivers/infiniband/core/security.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c index 59b2f96d986a..ca16a53b9389 100644 --- a/drivers/infiniband/core/security.c +++ b/drivers/infiniband/core/security.c @@ -732,9 +732,10 @@ void ib_mad_agent_security_cleanup(struct ib_mad_agent *agent) if (!rdma_protocol_ib(agent->device, agent->port_num)) return; - security_ib_free_security(agent->security); if (agent->lsm_nb_reg) 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) |