[0.4.12][NTOS:PNP] Workaround a BSOD with HDAUDIO during boot PR#1560 CORE-15874
authorJoachim Henze <Joachim.Henze@reactos.org>
Wed, 12 Jun 2019 23:25:28 +0000 (01:25 +0200)
committerJoachim Henze <Joachim.Henze@reactos.org>
Wed, 12 Jun 2019 23:25:28 +0000 (01:25 +0200)
commit78b5bc9de7524417d4678415857c9fce202b83a1
tree1c7097bf76c72864381c60d76a1fb7b81154edcb
parent9513c9bf12926e82c6956910366e661539789933
[0.4.12][NTOS:PNP] Workaround a BSOD with HDAUDIO during boot PR#1560 CORE-15874

Thanks to Thomas Faber, author of the patch.
I depend on external testers here for confirmation of effectiveness.

We think the problem was unhidden by 0.4.12-dev-757-g
789cfd3ddc6cd15d80db120d0ddcc1e7616ce85d
and surrounding works.

When traversing the device tree, keep a reference to the current device.
Devices can be deleted during the traversal, so in order to keep
the tree walk intact without use-after-free situations,
this just keeps the PDO around until we no longer need the device node.

It could be argued that this is a hack, however implementing it the "correct way"
(I haven't actually researched how Windows does this) is unlikely to be possible
with our current PNP manager -- so this should keep us going for a while.
ntoskrnl/io/pnpmgr/pnpmgr.c