Re: [PATCH rdma-next] RDMA/nldev: Fix section mismatch warning for nldev

Jason Gunthorpe
2022-10-28T16:03:43Z

On Fri, Oct 28, 2022 at 09:58:56AM +0300, Leon Romanovsky wrote:
> ppc64_defconfig) produced this warning:
>
> WARNING: modpost: drivers/infiniband/core/ib_core.o: section mismatch in reference: .init_module (section: .init.text) -> .nldev_exit (section: .exit.text)
>
> Fix it by removing __init/__exit markers as nldev is part of ib_core.ko
> and as such doesn't require any special notations for entry/exit functions.

This isn't what the problem is, the patch Stephen reported:

commit ad9394a3da33995dff828dbfd4540421e535bec9 (ko-rdma/for-rc)
Author: Chen Zhongjin <chenzhongjin@huawei.com>
Date: Tue Oct 25 10:41:46 2022 +0800

RDMA/core: Fix null-ptr-deref in ib_core_cleanup()

Adds a call to an __exit function from an __init function:

@@ -2815,10 +2815,18 @@ static int __init ib_core_init(void)

+err_parent:
+ rdma_nl_unregister(RDMA_NL_LS);
+ nldev_exit();
+ unregister_pernet_device(&rdma_dev_net_ops);

Which is not allowed

All that is required is to drop the __exit from nldev_exit, I'm going
to squash it in since I had to rebase it anyhow.

Jason