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

(cherry picked from commit e0e12405285b61a724c646b8f8e99e3ec775291e)

Details

Provenance
vmaffioneAuthored on Jan 14 2022, 9:09 PM
Parents
rG5e730b3fdecb: ipsec(4): Fix a few typos in error messages
Branches
Unknown
Tags
Unknown