diff mbox

Atmel_usba_udc: Kernel panic in usba_ep_enable

Message ID 20150511163734.GA8831@panicking (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Nazzareno Trimarchi May 11, 2015, 4:37 p.m. UTC
Hi

On Mon, May 11, 2015 at 05:58:27PM +0200, Angelo Compagnucci wrote:
> Hello List,
> 
> I'm having troubles with usb audio on an SAMA5D3 on 3.19.8 with a
> strange kernel panic.
> 
> The function f_audio_set_alt (f_uac1.c) is passing a NULL out_ep and
> so the usba_ep_enable crashes with a null pointer dereference as you
> can see from the debugging output:
> 
> [   24.210000] ep1: ep_enable: desc=  (null)
> 
> Unfortunately, there is nothing strange with my configuration, I'm
> trying to use the soundcard (which plays files flawlessly) as a usb
> soundcard, so the only thing I did was to compile g_audio as a module,
> enable UAC1 and did a modprode.
> 

Please apply:

commit 8d252db174ab27485126f540f368149e3c875e5a
Author: Xuebing Wang <xbing6@gmail.com>
Date:   Wed Dec 10 16:28:15 2014 +0800

    usb: gadget: f_uac1: update Class-Specific AudioControl Interface Header Descriptor
    
    Update this according to USB Audio Class 1.0 spec. This fixes the Windows 7
    detection issue.
    
    Cc: Rafael Brune <mail@rbrune.de>
    Signed-off-by: Xuebing Wang <xbing6@gmail.com>
    Signed-off-by: Fabio Estevam <festevam@gmail.com>
    Signed-off-by: Peter Chen <peter.chen@freescale.com>
    (Fixed some code style issues)
    Tested-by: Peter Chen <peter.chen@freescale.com>
    Signed-off-by: Felipe Balbi <balbi@ti.com>

commit 625763d101c7aa706b35f052cd978a61f1ef26bc
Author: Xuebing Wang <xbing6@gmail.com>
Date:   Wed Dec 10 16:28:14 2014 +0800

    usb: gadget: f_uac1: configure endpoint before using it
    
    UAC1 forget to do it.
    
    Signed-off-by: Xuebing Wang <xbing6@gmail.com>
    Signed-off-by: Peter Chen <peter.chen@freescale.com>
    Signed-off-by: Felipe Balbi <balbi@ti.com>


and check the error of the configure

From 36faa76befcdcc0d273c8cea32fef82f2fb85771 Mon Sep 17 00:00:00 2001
From: Michael Trimarchi <michael@amarulasolutions.com>
Date: Mon, 11 May 2015 18:30:52 +0200
Subject: [PATCH] f_uac1: check return code from config_ep_by_speed

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/usb/gadget/function/f_uac1.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
index 9719abf..7856b33 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -588,7 +588,10 @@  static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 
 	if (intf == 1) {
 		if (alt == 1) {
-			config_ep_by_speed(cdev->gadget, f, out_ep);
+			err = config_ep_by_speed(cdev->gadget, f, out_ep);
+			if (err)
+				return err;
+
 			usb_ep_enable(out_ep);
 			out_ep->driver_data = audio;
 			audio->copy_buf = f_audio_buffer_alloc(audio_buf_size);