]> git.karo-electronics.de Git - karo-tx-linux.git/commit
rtlwifi: usb: allocate URB control message setup_packet and data buffer separately
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>
Mon, 18 Feb 2013 08:29:30 +0000 (10:29 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 6 Mar 2013 03:24:03 +0000 (03:24 +0000)
commit9e2282d4b05fdc74ef5677174d3146494dff64a9
tree89e2f4441cd98c6760466bba4521d404d3946ffb
parent0d15de8ef0b034aa2829ed18492a08789a6ece8a
rtlwifi: usb: allocate URB control message setup_packet and data buffer separately

commit bc6b89237acb3dee6af6e64e51a18255fef89cc2 upstream.

rtlwifi allocates both setup_packet and data buffer of control message urb,
using shared kmalloc in _usbctrl_vendorreq_async_write. Structure used for
allocating is:
struct {
u8 data[254];
struct usb_ctrlrequest dr;
};

Because 'struct usb_ctrlrequest' is __packed, setup packet is unaligned and
DMA mapping of both 'data' and 'dr' confuses ARM/sunxi, leading to memory
corruptions and freezes.

Patch changes setup packet to be allocated separately.

[v2]:
 - Use WARN_ON_ONCE instead of WARN_ON

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/wireless/rtlwifi/usb.c