HomeFreeBSD

netmap: fix LOR in iflib_netmap_register

Description

netmap: fix LOR in iflib_netmap_register

In iflib_device_register(), the CTX_LOCK is acquired first and then
IFNET_WLOCK is acquired by ether_ifattach(). However, in netmap_hw_reg()
we do the opposite: IFNET_RLOCK is acquired first, and then CTX_LOCK
is acquired by iflib_netmap_register(). Fix this LOR issue by wrapping
the CTX_LOCK/UNLOCK calls in iflib_device_register with an additional
IFNET_WLOCK. This is safe since the IFNET_WLOCK is recursive.

MFC after: 1 month

Details

Provenance
vmaffioneAuthored on Jan 14 2022, 9:09 PM
Parents
rG9f0b56872c1f: carp(4): Make regex additionally match on VLAN interfaces
Branches
Unknown
Tags
Unknown