HomeFreeBSD

g_dev_orphan(): Return early if the device is already gone

Description

g_dev_orphan(): Return early if the device is already gone

The following panic was the result of running "cdcontrol eject" after
using the physical ejection key on the device before the tray was
actually ejected. So we have hardware racing software.

The device was loaded with a DVD.

Resulted in a NULL pointer dereference

g_dev_orphan() at g_dev_orphan+0x2e/frame 0xfffffe01eba0a9f0
g_resize_provider_event() at g_resize_provider_event+0x71/frame 0xfffffe01eba0aa20
g_run_events() at g_run_events+0x20e/frame 0xfffffe01eba0aa70
fork_exit() at fork_exit+0x85/frame 0xfffffe01eba0aab0
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe01eba0aab0

Avoid this possibility and return early of dev is NULL already.

PR: 215856
Reviewed by: imp (I've triggered this once or twice over the years too)
Sponsored by: Netflix

Details

Provenance
fk_fabiankeil.deAuthored on Thu, Mar 13, 11:13 PM
impCommitted on Thu, Mar 13, 11:20 PM
Parents
rG732c16884215: ObsoleteFiles: Remove if_rtwn.4 removal
Branches
Unknown
Tags
Unknown