The data path shall stop pushing data to protocol start or input
routines while changing the aggregation protocol, otherwise it is
possible to access freed protocol private data.
Also, some protocols have stop routine, and the stop routine shall
be invoked prior to detaching the protocol.
Fix them by,
- Call lagg_stop() to full stop the interface before changing the
aggregation protocol.
- The access to if_drv_flags lacks proper synchronization. Introduce
sc_state, a driver private state, and access it atomically to prevent
the data path from getting the stale running state.
While here, for the LACP protocol, stop calling lacp_init() within
lacp_attach(). lagg_proto_init() is the generic wrapper of protocol
init routine, and should be used instead.
PR: 289017
Reported by: Gui-Dong Han <hanguidong02@gmail.com>
MFC after: 5 days