[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2025041154-refinery-bronzing-7893@gregkh>
Date: Fri, 11 Apr 2025 15:50:42 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Wentao Liang <vulab@...as.ac.cn>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH] usb: renesas_usbhs: Add error handling for
usbhsf_fifo_select()
On Wed, Apr 02, 2025 at 08:45:15PM +0800, Wentao Liang wrote:
> In usbhsf_dcp_data_stage_prepare_pop(), the return value of
> usbhsf_fifo_select() needs to be checked. A proper implementation
> can be found in usbhsf_dma_try_pop_with_rx_irq().
>
> Add an error check and jump to PIO pop when FIFO selection fails.
>
> Fixes: 9e74d601de8a ("usb: gadget: renesas_usbhs: add data/status stage handler")
> Cc: stable@...r.kernel.org # v3.2+
> Signed-off-by: Wentao Liang <vulab@...as.ac.cn>
> ---
> drivers/usb/renesas_usbhs/fifo.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
How was this tested?
>
> diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
> index 10607e273879..6cc07ab4782d 100644
> --- a/drivers/usb/renesas_usbhs/fifo.c
> +++ b/drivers/usb/renesas_usbhs/fifo.c
> @@ -466,6 +466,7 @@ static int usbhsf_dcp_data_stage_prepare_pop(struct usbhs_pkt *pkt,
> struct usbhs_pipe *pipe = pkt->pipe;
> struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
> struct usbhs_fifo *fifo = usbhsf_get_cfifo(priv);
> + int ret;
>
> if (usbhs_pipe_is_busy(pipe))
> return 0;
> @@ -480,10 +481,14 @@ static int usbhsf_dcp_data_stage_prepare_pop(struct usbhs_pkt *pkt,
>
> usbhs_pipe_sequence_data1(pipe); /* DATA1 */
>
> - usbhsf_fifo_select(pipe, fifo, 0);
> + ret = usbhsf_fifo_select(pipe, fifo, 0);
> + if (ret < 0)
> + goto usbhsf_pio_prepare_pop;
> +
> usbhsf_fifo_clear(pipe, fifo);
> usbhsf_fifo_unselect(pipe, fifo);
>
> +usbhsf_pio_prepare_pop:
> /*
> * change handler to PIO pop
> */
This change really looks wrong and I would like you to test and verify
tha it actually works before going forward.
thanks,
greg k-h
Powered by blists - more mailing lists