Page MenuHomeFreeBSD

ufshci: fix WLUN periph reference counting
ClosedPublic

Authored by jaeyoon on Aug 5 2026, 8:00 AM.
Tags
None
Referenced Files
F170594602: D58658.diff
Sat, Sep 5, 1:46 PM
F170585151: D58658.id183756.diff
Sat, Sep 5, 12:49 PM
F170578840: D58658.id183756.diff
Sat, Sep 5, 12:07 PM
Unknown Object (File)
Fri, Sep 4, 11:33 AM
Unknown Object (File)
Thu, Sep 3, 5:58 PM
Unknown Object (File)
Thu, Sep 3, 3:21 PM
Unknown Object (File)
Thu, Sep 3, 1:55 PM
Unknown Object (File)
Thu, Sep 3, 8:24 AM
Subscribers
None

Details

Summary

The driver stored the WLUN periph pointer without holding a reference,
so the pointer went stale when the pass(4) device went away. In
addition, ufshci_sim_send_ssu() released a reference that it had never
acquired.

Define a simple ownership rule. ufshci_sim_find_periph() acquires the
periph and returns it. The cache owns one reference. The controller
destructor drops it with cam_periph_release() before taking the SIM
lock, since the release takes the CAM device lock by itself.
ufshci_sim_send_ssu() acquires its own reference and releases it when
done. Reuse the cached periph instead of searching again, so the old
reference is not leaked.

Sponsored by: Samsung Electronics

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable