at76c50x-usb: Don't perform DMA from stack memory
authorAndrea Merello <andrea.merello@gmail.com>
Sat, 24 May 2014 15:07:12 +0000 (17:07 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 29 May 2014 17:08:10 +0000 (13:08 -0400)
commit174beab7d4451bc392e92b548d35f500510a2f84
treef24ac04cc82ca0b2baf8ce6e8f0aff24baebdfd5
parent7dd74f5fabe5681ba584acc402a6313126cc53c0
at76c50x-usb: Don't perform DMA from stack memory

Loading the driver with DMA debugging enabled makes the kernel to complain
about the ehci driver trying to perform DMA from memory from the stack.

[ 9848.229514] WARNING: CPU: 1 PID: 627 at lib/dma-debug.c:1153 check_for_stack+0xa4/0xf0()
[ 9848.237678] ehci-pci 0000:00:04.1: DMA-API: device driver maps memory fromstack [addr=ffff88006c80da01]

This is due to at76c50x-usb driver passing buffers allocated on the stack to
the USB layer, that attempts DMA. This occurs is several places.

This patch fixes the problem by allocating those buffers via kmalloc.

Since this adds some kfree() before leaving a couple of functions, I caught the
occasion to clean-up the exit path on error.

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/at76c50x-usb.c