Skip to content

Commit

Permalink
RDMA/cma: fix null-ptr-deref Read in cma_cleanup
Browse files Browse the repository at this point in the history
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: 045959d ("IB/cma: Add configfs for rdma_cm")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: zhengbin <[email protected]>
Reviewed-by: Parav Pandit <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Doug Ledford <[email protected]>
  • Loading branch information
zhengbin13 authored and dledford committed Aug 20, 2019
1 parent 841b07f commit a7bfb93
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/infiniband/core/cma.c
Original file line number Diff line number Diff line change
Expand Up @@ -4724,10 +4724,14 @@ static int __init cma_init(void)
if (ret)
goto err;

cma_configfs_init();
ret = cma_configfs_init();
if (ret)
goto err_ib;

return 0;

err_ib:
ib_unregister_client(&cma_client);
err:
unregister_netdevice_notifier(&cma_nb);
ib_sa_unregister_client(&sa_client);
Expand Down

0 comments on commit a7bfb93

Please sign in to comment.