On Tue, Apr 21, 2009 at 12:47 AM, Greg KH <greg@xxxxxxxxx> wrote: > Ick, please point out the place where this happens, and we will gladly > fix it up, that is a bug in the driver (which will prevent it from > properly working on existing arches today.) > drivers/media/video/pwc/pwc-ctrl.c all uses of SendControlMsg, RecvControlMsg, send_video_command I have prepared a patch and will post later this evening (once I get out from behind the firewall that stops me connecting to gmail via SMTP) >> Maybe the core could give a warning message in this case. > > If you can come up with a check that will work properly for this, please > let us know. I think we have tried it before, but failed for some > reason. > Well I was thinking of something very simple like: diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 81fa850..1aa2ca7 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -1247,6 +1247,9 @@ static int map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, DMA_TO_DEVICE); } } + + WARN_ONCE(urb->transfer_buffer_length && (urb->transfer_dma & 3), + "Non aligned transfer buffer - stack allocated?\n"); return ret; } Granted this doesn't check if the pointer is on the stack (is there a architecture independent way to do that?) and some platforms may have stricter requirements that it doesn't catch. This works for me (on ARM) Though thinking about it some more maybe it would be better to check the input address (urb->transfer_buffer) rather than the dma_mapping result. [are there any buses or architectures where the dma mapping result isn't anything like an address but just a kind of handle (1,2,3)?] Am I missing something? Martin -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html