Used but not initialised:

        $ grep arp_list if_ether.c
                LIST_ENTRY(llinfo_arp)   la_list;       /* [mN] global arp_list 
*/
        LIST_HEAD(, llinfo_arp) arp_list; /* [mN] list of all llinfo_arp 
structures */
                /* Net lock is exclusive, no arp mutex needed for arp_list 
here. */
                LIST_FOREACH_SAFE(la, &arp_list, la_list, nla) {
                        LIST_INSERT_HEAD(&arp_list, la, la_list);

It only works because arp_list is global and thus zero initialised, so

        #define LIST_INIT(head) do {                                            
\
                LIST_FIRST(head) = LIST_END(head);                              
\
        } while (0)

is practically a NOOP, but we must not rely on that.
Use proper queue(9) init (in analogy to nd6_init() and nd6_list).

OK?

Index: netinet/if_ether.c
===================================================================
RCS file: /cvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.256
diff -u -p -r1.256 if_ether.c
--- netinet/if_ether.c  31 Jan 2023 13:41:54 -0000      1.256
+++ netinet/if_ether.c  2 Mar 2023 09:19:53 -0000
@@ -146,6 +146,7 @@ arpinit(void)
 {
        static struct timeout arptimer_to;
 
+       LIST_INIT(&arp_list);
        pool_init(&arp_pool, sizeof(struct llinfo_arp), 0,
            IPL_SOFTNET, 0, "arp", NULL);
 

Reply via email to