Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 2025 21:37:14 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ff77f1ca5ae8 - main - umass: Fix a direct call to sc_transform
Message-ID:  <202505072137.547LbEAB092222@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=ff77f1ca5ae8dd7fcaee54672067e1493d953d7e

commit ff77f1ca5ae8dd7fcaee54672067e1493d953d7e
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-05-07 16:07:45 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-05-07 21:36:55 +0000

    umass: Fix a direct call to sc_transform
    
    Call umass_std_transform instead of following the sc_transform member to
    get the standard transforms now that has moved to
    umass_std_transform. Pass NULL as the CCB so that we don't stomp on the
    status that was just set (and allow that in std_transform).
    
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D49474
---
 sys/dev/usb/storage/umass.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c
index 04a0157b14ce..c3a5028f5726 100644
--- a/sys/dev/usb/storage/umass.c
+++ b/sys/dev/usb/storage/umass.c
@@ -2625,11 +2625,14 @@ umass_cam_sense_cb(struct umass_softc *sc, union ccb *ccb, uint32_t residue,
 			DPRINTF(sc, UDMASS_SCSI, "Doing a sneaky"
 			    "TEST_UNIT_READY\n");
 
-			/* the rest of the command was filled in at attach */
-
-			if ((sc->sc_transform)(sc,
+			/*
+			 * Transform the TUR and if successful, send it.  Pass
+			 * NULL for the ccb so we don't override the above
+			 * status.
+			 */
+			if (umass_std_transform(sc, NULL,
 			    &sc->cam_scsi_test_unit_ready.opcode,
-			    sizeof(sc->cam_scsi_test_unit_ready)) == 1) {
+			    sizeof(sc->cam_scsi_test_unit_ready))) {
 				umass_command_start(sc, DIR_NONE, NULL, 0,
 				    ccb->ccb_h.timeout,
 				    &umass_cam_quirk_cb, ccb);
@@ -2890,7 +2893,8 @@ umass_std_transform(struct umass_softc *sc, union ccb *ccb,
 	}
 	if (sc->sc_transform(sc, cmd, cmd_len))
 		return (true);	/* Execute command */
-	umass_cam_illegal_request(ccb);
+	if (ccb)
+		umass_cam_illegal_request(ccb);
 	return (false);		/* Already failed -- don't submit */
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505072137.547LbEAB092222>