HomeFreeBSD

When removing ifnets, we should first remove the reference to ifnet
rS220317Unpublished

Unpublished Commit ยท Learn More

No further details are available.

Description

When removing ifnets, we should first remove the reference to ifnet
from the interface index, then decrease refcount, not vice versa.

Otherwise there is a race (reproducible) when if_free_internal()
contests on IFNET_WLOCK(), and we got a zero-refed ifnet in the
index for a long time. It may be picked by some other thread,
that runs ifnet_byindex_ref(), who takes the ifnet from index,
and bumps refcount. When reader drops the lock, if_free_internal()
proceeds with free. Then reader tries to free it a second time.

Details

Provenance
glebiusAuthored on
Parents
rS220316: Lower WARNS to unbreak the build, some archs may have alignment issues.
Branches
Unknown
Tags
Unknown

Event Timeline