On Wed, Feb 28, 2024 at 02:47:03PM +0300, Alexander Ofitserov wrote: > The gtp_link_ops operations structure for the subsystem must be > registered after registering the gtp_net_ops pernet operations structure. A fix for this was already applied, see: commit 136cfaca22567a03bbb3bf53a43d8cb5748b80ec Author: Vasiliy Kovalev <kovalev@xxxxxxxxxxxx> Date: Wed Feb 14 19:27:33 2024 +0300 gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp() > diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c > index 2129ae42c7030..0ddec4cc84093 100644 > --- a/drivers/net/gtp.c > +++ b/drivers/net/gtp.c > @@ -1903,26 +1903,26 @@ static int __init gtp_init(void) > > get_random_bytes(>p_h_initval, sizeof(gtp_h_initval)); > > - err = rtnl_link_register(>p_link_ops); > + err = register_pernet_subsys(>p_net_ops); > if (err < 0) > goto error_out; BTW, I like that this calls register_pernet_subsys() before rtnl_link_register(), where a rtnetlink request could come before pernet is set up. > - err = register_pernet_subsys(>p_net_ops); > + err = rtnl_link_register(>p_link_ops); > if (err < 0) > - goto unreg_rtnl_link; > + goto unreg_pernet_subsys; > > err = genl_register_family(>p_genl_family); > if (err < 0) > - goto unreg_pernet_subsys; > + goto unreg_rtnl_link; > > pr_info("GTP module loaded (pdp ctx size %zd bytes)\n", > sizeof(struct pdp_ctx)); > return 0; > > -unreg_pernet_subsys: > - unregister_pernet_subsys(>p_net_ops); > unreg_rtnl_link: > rtnl_link_unregister(>p_link_ops); > +unreg_pernet_subsys: > + unregister_pernet_subsys(>p_net_ops); > error_out: > pr_err("error loading GTP module loaded\n"); > return err; > -- > 2.42.1 > >