IB/core: Unregister notifier before freeing MAD security
authorDaniel Jurgens <danielj@mellanox.com>
Sat, 2 Feb 2019 09:09:42 +0000 (11:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2019 05:20:52 +0000 (07:20 +0200)
commit2fecdc27f5cdbf97c6f7a10bfc45e620182fc10c
treebdbb93ceae25a2a07d90d0dbcdac66403a91cf99
parent0d7ae54867f917d4f3b50508e036002051410b6b
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>
drivers/infiniband/core/security.c