git: 154e335cd635 - main - ufshci: fail attribute reads on a non-zero config result code
Jaeyoon Choi <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.current.scm |
|---|---|
| Message-ID | <[email protected]> |
The branch main has been updated by jaeyoon: URL: https://cgit.FreeBSD.org/src/commit/?id=154e335cd635436c69ad98723e25988852bd11db commit 154e335cd635436c69ad98723e25988852bd11db Author: Jaeyoon Choi <[email protected]> AuthorDate: 2026-08-10 01:33:00 +0000 Commit: Jaeyoon Choi <[email protected]> CommitDate: 2026-08-10 02:28:47 +0000 ufshci: fail attribute reads on a non-zero config result code ufshci_uic_send_cmd() only logged the error code and returned success, so a failed DME_GET gave its caller a stale value as if it were valid. The gear and lane settings could then be programmed from that garbage. Return ENXIO for reads instead. Writes keep logging and continuing, because a device may reject an optional attribute and that must not fail bring-up. Sponsored by: Samsung Electronics Reviewed by imp (mentor) Differential Revision: https://reviews.freebsd.org/D58654 --- sys/dev/ufshci/ufshci_uic_cmd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/ufshci/ufshci_uic_cmd.c b/sys/dev/ufshci/ufshci_uic_cmd.c index c6e6afe3f688..03ea8b2ba9f1 100644 --- a/sys/dev/ufshci/ufshci_uic_cmd.c +++ b/sys/dev/ufshci/ufshci_uic_cmd.c @@ -199,6 +199,14 @@ ufshci_uic_send_cmd(struct ufshci_controller *ctrlr, "Failed to send UIC command (Opcode: 0x%x" ", config result code = 0x%x)\n", uic_cmd->opcode, config_result_code); + /* + * Reads fail here: there is no valid result to return. + * Writes only log the error, so that a rejected optional + * attribute does not fail bring-up. + */ + if (return_value != NULL) + return (ENXIO); + return (0); } if (return_value != NULL)