ChangeSet 1.1276.8.1, 2004/01/28 12:28:28-08:00, zaitcev@redhat.com

[PATCH] USB: Patch for usb-storage in 2.4

Seems like obvious bugs found by out friends at IBM.


 drivers/usb/storage/transport.c |    2 +-
 drivers/usb/storage/usb.c       |    2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)


diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	Wed Jan 28 13:36:29 2004
+++ b/drivers/usb/storage/transport.c	Wed Jan 28 13:36:29 2004
@@ -1140,7 +1140,7 @@
 	US_DEBUGP("Bulk command S 0x%x T 0x%x Trg %d LUN %d L %d F %d CL %d\n",
 		  le32_to_cpu(bcb->Signature), bcb->Tag,
 		  (bcb->Lun >> 4), (bcb->Lun & 0x0F), 
-		  bcb->DataTransferLength, bcb->Flags, bcb->Length);
+		  le32_to_cpu(bcb->DataTransferLength), bcb->Flags, bcb->Length);
 	result = usb_stor_bulk_msg(us, bcb, pipe, US_BULK_CB_WRAP_LEN, 
 				   &partial);
 	US_DEBUGP("Bulk command transfer result=%d\n", result);
diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c	Wed Jan 28 13:36:29 2004
+++ b/drivers/usb/storage/usb.c	Wed Jan 28 13:36:29 2004
@@ -728,6 +728,7 @@
 
 		/* allocate an IRQ callback if one is needed */
 		if ((ss->protocol == US_PR_CBI) && usb_stor_allocate_irq(ss)) {
+			up(&(ss->dev_semaphore));
 			usb_dec_dev_use(dev);
 			return NULL;
 		}
@@ -735,6 +736,7 @@
 		/* allocate the URB we're going to use */
 		ss->current_urb = usb_alloc_urb(0);
 		if (!ss->current_urb) {
+			up(&(ss->dev_semaphore));
 			usb_dec_dev_use(dev);
 			return NULL;
 		}
