Thread (3 messages) 3 messages, 3 authors, 2008-07-11

Re: [PATCH RESEND] dm9601: don't do usb transfers of data on stack

From: Oliver Neukum <oliver@neukum.org>
Date: 2008-07-11 12:22:17

Possibly related (same subject, not in this thread)

Am Freitag 11 Juli 2008 14:17:58 schrieb Peter Korsgaard:
quoted
quoted
quoted
quoted
quoted
"Oliver" == Oliver Neukum [off-list ref] writes:
 >> dm_{read,write}_shared_word() were doing USB transfers of data on stack,
 >> which isn't allowed. Fix it by using the usbnet->data area like in
 >> dm9601_set_multicast().

 Oliver> You cannot do this. You've identified the bug correctly, but
 Oliver> the fix is incorrect. Doing DMA on non coherent architectures
 Oliver> means that any cacheline the buffer shares must not be
 Oliver> touched while DMA may be running. If you embed the buffer
 Oliver> into struct usbnet, how could you meet the guarantee?

Ahh. So kmalloc() / kfree() around the usb_control_msg isn dm_read /
dm_write is the way to go?
The buffer should be allocated with kmalloc. That doesn't mean it has to
be allocated each time the function is called. If several drivers do this, the
best fix is to modify struct usbnet so that it contains only a pointer to the
buffer, not the buffer itself and modify drivers accordingly.

	Regards
		Oliver
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help