Project

General

Profile

Bug #10285

ddi_fm_fini(9F) needs to be more explicit about when you should call it

Added by Robert Mustacchi 6 months ago.

Status:
New
Priority:
Normal
Category:
manpage - manual pages
Start date:
2019-01-24
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

While working on a driver Michael Zeller saw an issue where they were panicking in ddi_fm_fini() with the following call trace:

> $C
fffffe00198258a0 ddi_fm_fini+0x2e(fffffe1176caf808)
fffffe00198258d0 vxlnat_detach+0x34(fffffe1176caf808, 0)
fffffe0019825940 devi_detach+0xa7(fffffe1176caf808, 0)
fffffe0019825980 detach_node+0x6c(fffffe1176caf808, 8000000)
fffffe00198259f0 i_ndi_unconfig_node+0xa2(fffffe1176caf808, 4, 8000000)
fffffe0019825a20 i_ddi_detachchild+0x33(fffffe1176caf808, 8000000)
fffffe0019825a90 devi_detach_node+0x81(fffffe1176caf808, 8000000)
fffffe0019825b20 unconfig_immediate_children+0x18e(fffffe115b095010, 0, 8000000, c5)
fffffe0019825bb0 devi_unconfig_common+0x107(fffffe115b095010, 0, 8000000, c5, 0)
fffffe0019825c00 mt_config_thread+0x167(fffffe1167a39c90)
fffffe0019825c10 thread_start+8()

In this case, the FM handle was NULL because ddi_fm_init() was not called. However, this also happens when ddi_fm_init() is called with a capability explicitly set to DDI_FM_NOT_CAPABLE.

We should update the manual page to make it clearer that users should not call ddi_fm_fini() if DDI_FM_NOT_CAPABLE is returned in the resulting capability handle and that there's no need to call ddi_fm_init() if you're only passing DDI_FM_NOT_CAPABLE.

Also available in: Atom PDF