Creating a lagg port attaching i>0 interfaces and then destroying causes a crash
ifconfig lagg destroy
Steps to reproduce:
- ifconfig mce0 mce0
- ifconfig lagg0 create
- ifconfig lagg0 up laggproto lacp laggport mce0
- ifconfig lagg0 destroy
I believe this is caused by the following flow:
- lagg_clone_destroy is called
- we call: lagg_port_destroy(lp, 1); in a loop (going over all sc_ports)
- SLIST_REMOVE is called and we remove lp from sc_ports
- when the last interface is removed, inside lagg_port_destroy we enter the if : if (lp == sc->sc_primary) and because sc_ports is empty, lp0 == NULL
- We call: lagg_port_lladdr(lp0, lladdr); which means: lagg_port_lladdr(NULL, lladdr) and that causes a crash (we deference NULL inside lagg_port_lladdr).
This is a quick fix, I really don't know enough about the lagg module to say if this is the most correct solution.
Mark.