Re: [PATCH v3 net-next 06/15] neighbour: Store arp_tbl and nd_tbl in net->neigh_tables[].

Kuniyuki Iwashima <[email protected]>
Newsgroups org.kernel.vger.netdev
Message-ID <CAAVpQUD3R-Vi6CQYS5MRtE13u5LgxZ1JNnn3MDkT78VE5zWTzQ@mail.gmail.com>
On Tue, Aug 11, 2026 at 8:19 AM David Ahern <[email protected]> wrote:
>
> On 8/10/26 8:23 PM, Kuniyuki Iwashima wrote:
> > diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
> > index d409f606aec0..bad17d5aeafc 100644
> > --- a/net/ipv4/arp.c
> > +++ b/net/ipv4/arp.c
> > @@ -1495,15 +1495,34 @@ static const struct seq_operations arp_seq_ops = {
> >
> >  static int __net_init e(struct net *net)
> >  {
> > +     int err;
> > +
> > +     err = neigh_table_register(net, &arp_tbl, NEIGH_ARP_TABLE);
> > +     if (err)
> > +             goto err;
> > +
> > +#ifdef CONFIG_PROC_FS
> >       if (!proc_create_net("arp", 0444, net->proc_net, &arp_seq_ops,
> > -                     sizeof(struct neigh_seq_state)))
>
> proc_create_net already handles CONFIG_PROC_FS. It is not clear to me
> why you need to add the check here and below.

Actually it does not handle the case well because the =n case returns
NULL and setup_net() fails to initialise init_net and dies.

Most callers have the same issue (e.g. NFS can boot w/ =n but triggers
oops immediately) and it can be followed up if needed, but I didn't want
them as the prereq series.


>
> > -             return -ENOMEM;
> > +                          sizeof(struct neigh_seq_state))) {
> > +             err = -ENOMEM;
> > +             goto err_proc_create;
> > +     }
> > +#endif
> > +
> >       return 0;
> > +
> > +#ifdef CONFIG_PROC_FS
> > +err_proc_create:
> > +     neigh_table_unregister(net, NEIGH_ARP_TABLE);
> > +#endif
> > +err:
> > +     return err;
> >  }
> >
> >  static void __net_exit arp_net_exit(struct net *net)
> >  {
> >       remove_proc_entry("arp", net->proc_net);
> > +     neigh_table_unregister(net, NEIGH_ARP_TABLE);
> >  }
> >
> >  static struct pernet_operations arp_net_ops = {
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.