Page MenuHomeFreeBSD

ufshci: fix WLUN periph reference counting
ClosedPublic

Authored by jaeyoon on Wed, Aug 5, 8:00 AM.
Tags
None
Referenced Files
F169532503: D58658.diff
Tue, Sep 1, 8:23 PM
F169516734: D58658.id183421.diff
Tue, Sep 1, 7:08 PM
F169486103: D58658.id183756.diff
Tue, Sep 1, 4:26 PM
F169478088: D58658.id.diff
Tue, Sep 1, 3:41 PM
F169451508: D58658.diff
Tue, Sep 1, 2:02 PM
Unknown Object (File)
Sat, Aug 29, 4:08 PM
Unknown Object (File)
Sat, Aug 29, 4:04 PM
Unknown Object (File)
Fri, Aug 28, 1:00 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