Re: [PATCH v1 1/2] usb: gadget: udc: core: Invoke usb_gadget_connect only when started
From: Greg KH
Date: Thu Apr 06 2023 - 02:29:55 EST
On Thu, Apr 06, 2023 at 06:19:04AM +0000, Badhri Jagan Sridharan wrote:
> usb_udc_connect_control does not check to see if the udc
> has already been started. This causes gadget->ops->pullup
> to be called through usb_gadget_connect when invoked
> from usb_udc_vbus_handler even before usb_gadget_udc_start
> is called. Guard this by checking for udc->started in
> usb_udc_connect_control before invoking usb_gadget_connect.
>
> Guarding udc_connect_control, udc->started and udc->vbus
> with its own mutex as usb_udc_connect_control_locked
> can be simulataneously invoked from different code paths.
>
> Cc: stable@xxxxxxxxxxxxxxx
>
> Signed-off-by: Badhri Jagan Sridharan <badhri@xxxxxxxxxx>
> Fixes: 628ef0d273a6 ("usb: udc: add usb_udc_vbus_handler")
> ---
> drivers/usb/gadget/udc/core.c | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
Why resend v1 when it's been reviewed already?
confused,
greg k-h