Kernel patch to work around deficiencies in usbmon
Pete Zaitcev
zaitcev at redhat.com
Mon Jul 11 03:25:39 UTC 2005
Hi, Dave:
We have usbmon enabled now and it's good, but usb-storage moved away
from under me a little bit. It now maps everything for DMA beforehand,
which makes usbmon to miss the SCSI commands and replies.
I am going to address this problem in usbmon, where it belongs, but
it requires some work which is not done.
What do you think about carrying the attached patch for a few months
(I hope to turn around sooner, but you know how that works!)
-- Pete
diff -urp -X dontdiff linux-2.6.12/drivers/usb/storage/transport.c linux-2.6.12-lem/drivers/usb/storage/transport.c
--- linux-2.6.12/drivers/usb/storage/transport.c 2005-06-21 12:58:48.000000000 -0700
+++ linux-2.6.12-lem/drivers/usb/storage/transport.c 2005-07-06 14:00:30.000000000 -0700
@@ -948,8 +948,9 @@ int usb_stor_Bulk_max_lun(struct us_data
int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
{
- struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
- struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) us->iobuf;
+ /* Offset into iobuf a little in order to defeat pre-set DMA */
+ struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) (us->iobuf + 4);
+ struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) (us->iobuf + 4);
unsigned int transfer_length = srb->request_bufflen;
unsigned int residue;
int result;
@@ -960,7 +961,7 @@ int usb_stor_Bulk_transport(struct scsi_
/* Take care of BULK32 devices; set extra byte to 0 */
if ( unlikely(us->flags & US_FL_BULK32)) {
cbwlen = 32;
- us->iobuf[31] = 0;
+ ((unsigned char *)bcb)[31] = 0;
}
/* set up the command wrapper */
More information about the devel
mailing list