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:22:58 +0000 (07:22 +0200)
commit4cbfe6e7366c0270ac7a979bea3fe514d8e9dfcc
tree552442a97e2ad390dfb6fd131a903a33269a9721
parent2f86122bd369e11ebdc4136a56bda0f5484e9b0d
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