Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 02 Dec 2007 17:20:31 -0500
From:      Ben Kelly <bkelly@vadev.org>
To:        freebsd-usb@freebsd.org
Subject:   [patch] possible bug in umass_scsi_transform
Message-ID:  <47532FAF.6090403@vadev.org>

next in thread | raw e-mail | index | archive | help
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 */



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