Re: [PATCH V2] usb: gadget: f_uac1: check return code from config_ep_by_speed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Felipe

On Mon, May 18, 2015 at 05:28:58PM +0200, Michael Trimarchi wrote:
> Not checking config_ep_by_speed could lead to a kernel
> NULL pointer dereference error in usb_ep_enable
> 
> Cc: Felipe Balbi <balbi@xxxxxx>
> Signed-off-by: Michael Trimarchi <michael@xxxxxxxxxxxxxxxxxxxx>
> 
> ---
> 
> v2:
> - fix mail subject
> - add description
>

Is it fine now? My last email was rejected by the mailing list (html tags)

Michael
 
> ---
>  drivers/usb/gadget/function/f_uac1.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> 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);
> -- 
> 1.9.1
> 

-- 
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux