Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
During if_detach(), we get a race where a closing socket is releasing multicast data (via inp_freemoptions()) at the same time as igmp_ifdetach() is releasing all multicast data for the interface, resulting in a potential double teardown and double free. This bug has been present since late 2011: Author: jhb <jhb@FreeBSD.org> Defer the work of freeing IPv4 multicast options from a socket to an asychronous task. ... It is very hard to trip over. You must create and delete interfaces (bridges that join real interfaces are good candidates) repeatedly, and even then, if M_IPMADDR (in_multi data structure) memory is not reused for something else during the race, the reference count in inm->inm_refcount is an unsigned int, so it decrements from the left-over 0 to 4294967295, avoiding a second free. Turning on the memory debug options (scribbling values over freed memory) catches the problem more quickly, though you still must create and destroy interfaces that partcipate in multicast to see it. The fix here is a kludge, but should serve until the entire network locking code and up/downcall system is reworked.
- Loading branch information