Prevent deadlock in cad_down()
authorvisa <visa@openbsd.org>
Mon, 7 Mar 2022 13:02:53 +0000 (13:02 +0000)
committervisa <visa@openbsd.org>
Mon, 7 Mar 2022 13:02:53 +0000 (13:02 +0000)
commitdc7152bbcaa6dbc36fd32dc090c3cdb93210399e
tree43273c6f5e37575fcfd6a3fce4b2809e8c87ff0e
parent0f4e471e28941e65adc68561ffb861dd4a8345a0
Prevent deadlock in cad_down()

Introduce an rwlock to serialize cad(4) ioctl operations so that
cad_down() can release NET_LOCK() temporarily when invoking barriers.
This releasing prevents a possible deadlock with the taskq barrier.
The deadlock was pointed out by witness(4).

In addition, release NET_LOCK() when allocating memory in cad_up()
to reduce the risk of ill effects.
sys/dev/fdt/if_cad.c