Page MenuHomeFreeBSD

ufshci: tolerate partially constructed queues in SDB teardown
ClosedPublic

Authored by jaeyoon on Wed, Aug 5, 8:03 AM.
Tags
None
Referenced Files
F169124335: D58660.id183757.diff
Mon, Aug 31, 12:09 PM
F169123460: D58660.id.diff
Mon, Aug 31, 12:01 PM
Unknown Object (File)
Sat, Aug 29, 11:04 AM
Unknown Object (File)
Fri, Aug 28, 7:05 PM
Unknown Object (File)
Fri, Aug 28, 7:01 PM
Unknown Object (File)
Thu, Aug 27, 12:02 AM
Unknown Object (File)
Wed, Aug 26, 6:20 AM
Unknown Object (File)
Tue, Aug 25, 7:02 PM
Subscribers
None

Details

Summary

When attach fails, ufshci_req_sdb_destroy() runs on a partially
constructed queue, and it runs twice: once from the construct error
path and once from the controller destructor.

Make that safe: NULL-check each resource before freeing it and clear
the pointer afterwards, so a second call finds nothing to do. The
construct error label no longer frees the command descriptors itself,
which fixes a double free of ucd_bus_addr. Also destroy the payload
DMA tag, which was previously leaked. Drop the mtx_initialized()
checks: the locks are always set up before any failure path can reach
the destroy.

Attach can also fail before the queues were constructed at all. The
destructor would then call a NULL qops.destroy pointer, so skip the
destroy when the queue was never set up.

Sponsored by: Samsung Electronics

Diff Detail

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