[patch] possible bug in umass_scsi_transform

Ben Kelly bkelly at vadev.org
Sun Dec 2 14:46:38 PST 2007


While looking at usb/95173 I noticed what appears to be a bug in 
umass_scsi_transform().  Specifically, a TEST_UNIT_READY command will 
have the FORCE_SHORT_INQUIRY quirk logic applied to it due to the switch 
statement fall-through.  Unless these two commands are equivalent in 
some way, it would seem that you would only want to apply the 
FORCE_SHORT_INQUIRY quirk to INQUIRY commands.

I'm attaching a possible fix for the problem, but I cannot test it as I 
don't have any devices requiring these quirks.

Anyway, I just thought I would mention it.  I'm not that familiar with 
the code so its certainly possible I am off base here.

Thanks.

- Ben

--- /usr/src/sys/dev/usb/umass.c        2007-12-02 18:47:00.466926284 +0000
+++ umass.c     2007-12-02 22:07:44.896977086 +0000
@@ -3297,7 +3297,7 @@
                         (*rcmd)[4] = SSS_START;
                         return 1;
                 }
-               /* fallthrough */
+               break;
         case INQUIRY:
                 /* some drives wedge when asked for full inquiry 
information. */
                 if (sc->quirks & FORCE_SHORT_INQUIRY) {
@@ -3306,12 +3306,14 @@
                         (*rcmd)[4] = SHORT_INQUIRY_LENGTH;
                         return 1;
                 }
-               /* fallthrough */
+               break;
         default:
-               *rcmd = cmd;            /* We don't need to copy it */
-               *rcmdlen = cmdlen;
+               break;
         }

+       *rcmd = cmd;            /* We don't need to copy it */
+       *rcmdlen = cmdlen;
+
         return 1;
  }
  /* RBC specific functions */


More information about the freebsd-usb mailing list