Bug 145256

Summary: INQUIRY commands crash many USB storage devices
Product: [Fedora] Fedora Reporter: Steve Bangert <sbangert>
Component: halAssignee: David Zeuthen <davidz>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3CC: mclasen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://marc.theaimsgroup.com/?t=110570762200001&r=1&w=2
Whiteboard:
Fixed In Version: 0.4.7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-01-25 03:51:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Steve Bangert 2005-01-16 00:29:53 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041111 Firefox/1.0

Description of problem:
When using my Sandisk cruzer mini HAL crashes USB storage at times.
According to Allen Stern ( linux USB storage developer) HAL is sending
INQUIRY commands of 255 bytes when it should send 36 bytes, this
crashes USB storage.

Version-Release number of selected component (if applicable):
HAL-0.4.5-1-FC3

How reproducible:
Sometimes

Steps to Reproduce:
1.plugin Sandisk cruzer mini
2.wait for icon to appear on desktop
3.
    

Actual Results:  USB storage fails 

Expected Results:  contents of Sandisk crizer mini should be available

Additional info:

Comment 1 David Zeuthen 2005-01-20 18:57:28 UTC
> When using my Sandisk cruzer mini HAL crashes USB storage at times.
> According to Allen Stern ( linux USB storage developer) HAL is sending
> INQUIRY commands of 255 bytes when it should send 36 bytes, this
> crashes USB storage.

HAL doesn't send INQUIRY commands, it simply uses open(2), read(2)
etc. on the device file. What you're seeing is a defect with the
either the usb-storage driver or the SCSI midlayer, not with hald.

Comment 2 Alan Stern 2005-01-20 21:36:32 UTC
David is absolutely wrong about where the defect lies.  Opening a SCSI
disk device file (like /dev/sda or /dev/sda1) does _not_ cause any of
the SCSI layers, including usb-storage, to send an INQUIRY command.  I
have used a separate program many times to open(2) and read(2) device
files in this way; the only commands generated are TEST UNIT READY,
PREVENT MEDIUM REMOVAL, and READ(10).  The INQUIRY command must be
generated somewhere else, outside the kernel.

Now, it might not be generated by hald.  It might come from a program
or a library invoked by hald (or even from somewhere else entirely,
although that seems unlikely since Steve says his problem stops when
hald isn't running).

Unfortunately I can't test this easily on my system.  hald crashes
soon after starting with a segmentation violation when it tries
handling one of the USB buses.

Comment 3 David Zeuthen 2005-01-20 21:59:31 UTC
I stand corrected; after more thourough inspection of the code we do
indeed send a INQUIRY for attempting to read the drive_id off page
0x80. I will investigate this issue and provide some packages for testing.

Thanks for the notice and sorry for initially dismissing this bug.

Comment 4 David Zeuthen 2005-01-21 16:05:17 UTC
Hi,

Please try out these packages

 http://people.redhat.com/davidz/hal-cvs20050121/

which should contain the fix for this.

Thanks,
David

Comment 5 Steve Bangert 2005-01-21 20:56:25 UTC
David,
  The above packages appear to have fixed the USB storage issue, on an
unrelated concern I'm having problems with hald dying/sleeping after
my machine has been up and running for an hour or more, would you like
me to continue on this bug report or open a new one?  Steve

Comment 6 David Zeuthen 2005-01-25 03:51:54 UTC
Please open a new bug report for the other issue. Thanks, David.