aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2012-12-20 09:24:43 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-01-02 14:38:24 -0500
commit4c3de5920c486b8eefa6187ee6a181864c161100 (patch)
tree0368a2ded8fff18f8e6fc4d1442a816eaad393af /drivers/net/wireless
parent12e9432707dad5a09d8c51857b275c62bb6f91c8 (diff)
rtlwifi: fix incorrect use of usb_alloc_coherent with usb_control_msg
Incorrect use of usb_alloc_coherent memory as input buffer to usb_control_msg can cause problems in arch DMA code, for example kernel BUG at 'arch/arm/include/asm/dma-mapping.h:321' on ARM (linux-3.4). Change _usb_writeN_sync use kmalloc'd buffer instead. Cc: stable@vger.kernel.org Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Acked-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/rtlwifi/usb.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index 29f0969e4ba0..a3312b7c4907 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -210,17 +210,16 @@ static void _usb_writeN_sync(struct rtl_priv *rtlpriv, u32 addr, void *data,
210 u16 index = REALTEK_USB_VENQT_CMD_IDX; 210 u16 index = REALTEK_USB_VENQT_CMD_IDX;
211 int pipe = usb_sndctrlpipe(udev, 0); /* write_out */ 211 int pipe = usb_sndctrlpipe(udev, 0); /* write_out */
212 u8 *buffer; 212 u8 *buffer;
213 dma_addr_t dma_addr;
214 213
215 wvalue = (u16)(addr&0x0000ffff); 214 wvalue = (u16)(addr & 0x0000ffff);
216 buffer = usb_alloc_coherent(udev, (size_t)len, GFP_ATOMIC, &dma_addr); 215 buffer = kmalloc(len, GFP_ATOMIC);
217 if (!buffer) 216 if (!buffer)
218 return; 217 return;
219 memcpy(buffer, data, len); 218 memcpy(buffer, data, len);
220 usb_control_msg(udev, pipe, request, reqtype, wvalue, 219 usb_control_msg(udev, pipe, request, reqtype, wvalue,
221 index, buffer, len, 50); 220 index, buffer, len, 50);
222 221
223 usb_free_coherent(udev, (size_t)len, buffer, dma_addr); 222 kfree(buffer);
224} 223}
225 224
226static void _rtl_usb_io_handler_init(struct device *dev, 225static void _rtl_usb_io_handler_init(struct device *dev,