Re: NULL pointer dereference in at91_udc on start of connection

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

 



On Tue, Jul 10, 2012 at 03:54:06PM +0100, Mario Jorge Isidoro wrote:
> I've found that the following change also works, if someone doesn't want to simply eliminate the check
> diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
> index 7687ccd..33a6999 100644
> --- a/drivers/usb/gadget/at91_udc.c
> +++ b/drivers/usb/gadget/at91_udc.c
> @@ -475,7 +475,7 @@ static int at91_ep_enable(struct usb_ep *_ep,
>         unsigned long   flags;
> 
>         if (!_ep || !ep
> -                       || !desc || ep->ep.desc
> +                       || !desc || !ep->ep.desc

This check ensures that you do not try to enable an endpoint twice. Once
enabled, ep->ep.desc should be set.

>                         || _ep->name == ep0name
ep.desc is always NULL for ep0 and this one should not be enabled. Therefore
you have this check here.

>                         || desc->bDescriptorType != USB_DT_ENDPOINT
>                         || (maxpacket = usb_endpoint_maxp(desc)) == 0

That means with this change you should not get any endpoints enabled and it
should not work at all. Can you acknowledge this?

The crash happens in composite_setup() mind to figure out what is beeing
accessed here?

> Best regards,
> Mário Isidoro
> 

Sebastian
--
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