[SLOF] [PATCH] Fix "Unsupported PQ" problems in the scsi-disk open function

Thomas Huth thuth at redhat.com
Tue Apr 4 21:57:51 AEST 2017


The open function of the scsi-disk code has a bug: If it encounters
a Peripheral Qualifier != 0, it does not clean up the pointer to the
INQUIRY buffer before exiting, so the stack is messed up afterwards
and you get an ugly "Unknown Exception" before getting to the SLOF
prompt.
Also it's not a real error if the byte is set to 0x7f - this simply
means that the "SCSI target device is not capable of supporting a
peripheral device connected to this logical unit" (according to the
SPC-3 standard). So in this case, we should not issue an error
message, thus let's use the pointer to the INQUIRY buffer to check
whether the PQ/PDT byte is 0x7f to fix both problems.

Signed-off-by: Thomas Huth <thuth at redhat.com>
---
 slof/fs/scsi-disk.fs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/slof/fs/scsi-disk.fs b/slof/fs/scsi-disk.fs
index 9c0a9c1..97d9892 100644
--- a/slof/fs/scsi-disk.fs
+++ b/slof/fs/scsi-disk.fs
@@ -323,8 +323,12 @@ CREATE cdb 10 allot
 
     \ Skip devices with PQ != 0
     dup inquiry-data>peripheral c@ e0 and 0 <> IF
-        ." SCSI-DISK: Unsupported PQ != 0" cr
-	false EXIT
+        \ Ignore 7f, since this simply means that the target
+        \ is not supporting a peripheral device at this LUN.
+        inquiry-data>peripheral c@ 7f <> IF
+            ." SCSI-DISK: Unsupported PQ != 0" cr
+        THEN
+        false EXIT
     THEN
 
     inquiry-data>peripheral c@ CASE
-- 
1.8.3.1



More information about the SLOF mailing list