Commit a7bfb93f authored by zhengbin's avatar zhengbin Committed by Doug Ledford

RDMA/cma: fix null-ptr-deref Read in cma_cleanup

In cma_init, if cma_configfs_init fails, need to free the
previously memory and return fail, otherwise will trigger
null-ptr-deref Read in cma_cleanup.

cma_cleanup
  cma_configfs_exit
    configfs_unregister_subsystem

Fixes: 045959db ("IB/cma: Add configfs for rdma_cm")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarzhengbin <zhengbin13@huawei.com>
Reviewed-by: default avatarParav Pandit <parav@mellanox.com>
Link: https://lore.kernel.org/r/1566188859-103051-1-git-send-email-zhengbin13@huawei.comSigned-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 841b07f9
...@@ -4724,10 +4724,14 @@ static int __init cma_init(void) ...@@ -4724,10 +4724,14 @@ static int __init cma_init(void)
if (ret) if (ret)
goto err; goto err;
cma_configfs_init(); ret = cma_configfs_init();
if (ret)
goto err_ib;
return 0; return 0;
err_ib:
ib_unregister_client(&cma_client);
err: err:
unregister_netdevice_notifier(&cma_nb); unregister_netdevice_notifier(&cma_nb);
ib_sa_unregister_client(&sa_client); ib_sa_unregister_client(&sa_client);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment