lkml.org 
[lkml]   [2005]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [Linux-usb-users] Possible bug in usb storage (2.6.11 kernel)
From
>>>>> On Thu, 8 Sep 2005 16:40:16 -0400 (EDT), Alan Stern <stern@rowland.harvard.edu> said:

stern> I've long thought that usb-storage should allocate its own
stern> transfer buffer for sense data. In the past people have said,
stern> "No, don't bother, it's not really needed." Here's a good
stern> reason for doing it.

stern> Expect a patch before long.

Did you already create the patch? If not, how about this (against 2.6.13) ?


Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

diff -u linux-2.6.13/drivers/usb/storage/transport.c linux/drivers/usb/storage/transport.c
--- linux-2.6.13/drivers/usb/storage/transport.c 2005-08-29 08:41:01.000000000 +0900
+++ linux/drivers/usb/storage/transport.c 2005-09-27 18:03:32.000000000 +0900
@@ -638,7 +638,8 @@

/* use the new buffer we have */
old_request_buffer = srb->request_buffer;
- srb->request_buffer = srb->sense_buffer;
+ srb->request_buffer =
+ kmalloc(max(dma_get_cache_alignment(), 18), GFP_NOIO);

/* set the buffer length for transfer */
old_request_bufflen = srb->request_bufflen;
@@ -655,7 +656,13 @@
/* issue the auto-sense command */
old_resid = srb->resid;
srb->resid = 0;
- temp_result = us->transport(us->srb, us);
+ if (srb->request_buffer) {
+ temp_result = us->transport(us->srb, us);
+ memcpy(srb->sense_buffer, srb->request_buffer, 18);
+ kfree(srb->request_buffer);
+ } else {
+ temp_result = USB_STOR_TRANSPORT_FAILED;
+ }

/* let's clean up right away */
srb->resid = old_resid;

---
Atsushi Nemoto
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-09-27 15:41    [W:0.057 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site