From: Stefan Hajnoczi Date: Wed, 23 Nov 2011 08:20:45 +0000 (+0000) Subject: staging: line6: alloc/free buffers in hw_params/hw_free X-Git-Tag: v3.3-rc1~152^2~101^2~355 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=140e28b83c4a31831cbf293d9cab20c603821202;p=pandora-kernel.git staging: line6: alloc/free buffers in hw_params/hw_free It is unsafe to free buffers in line6_pcm_stop(), which is not allowed to sleep, since urbs cannot be killed completely there and only unlinked. This means I/O may still be in progress and the URB completion function still gets invoked. This may result in memory corruption when buffer_in is freed but I/O is still pending. Additionally, line6_pcm_start() is not supposed to sleep so it should not use kmalloc(GFP_KERNEL). These issues can be resolved by performing buffer allocation/freeing in the .hw_params/.hw_free callbacks instead. The ALSA documentation also recommends doing buffer allocation/freeing in these callbacks. Signed-off-by: Stefan Hajnoczi Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed