Page MenuHomeFreeBSD

ufshci: fix WLUN periph reference counting
ClosedPublic

Authored by jaeyoon on Aug 5 2026, 8:00 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 11, 4:57 PM
Unknown Object (File)
Tue, Oct 6, 9:57 PM
Unknown Object (File)
Mon, Oct 5, 2:17 PM
Unknown Object (File)
Fri, Oct 2, 10:22 AM
Unknown Object (File)
Fri, Oct 2, 9:02 AM
Unknown Object (File)
Sun, Sep 27, 3:30 PM
Unknown Object (File)
Sun, Sep 27, 8:54 AM
Unknown Object (File)
Thu, Sep 24, 8:19 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