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)
Thu, Sep 17, 5:46 PM
Unknown Object (File)
Wed, Sep 16, 8:26 AM
Unknown Object (File)
Sat, Sep 12, 9:45 AM
Unknown Object (File)
Thu, Sep 10, 6:24 PM
Unknown Object (File)
Thu, Sep 10, 6:56 AM
Unknown Object (File)
Wed, Sep 9, 10:20 AM
Unknown Object (File)
Tue, Sep 8, 10:16 PM
Unknown Object (File)
Tue, Sep 8, 1:14 PM
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