提交 fa750666 编写于 作者: D Daniel Jurgens 提交者: Xie XiuQi

IB/core: Unregister notifier before freeing MAD security

mainline inclusion
from mainline-5.0
commit d60667fc398e
category: bugfix
bugzilla: 12231
CVE: NA

-------------------------------------------------

If the notifier runs after the security context is freed an access of
freed memory can occur.

Fixes: 47a2b338 ("IB/core: Enforce security on management datagrams")
Signed-off-by: NDaniel Jurgens <danielj@mellanox.com>
Reviewed-by: NParav Pandit <parav@mellanox.com>
Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
Signed-off-by: NZhiqiang Liu <liuzhiqiang26@huawei.com>
Reviewed-by: NWenan Mao <maowenan@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 0a445ee1
...@@ -728,9 +728,10 @@ void ib_mad_agent_security_cleanup(struct ib_mad_agent *agent) ...@@ -728,9 +728,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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册