[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YoZpKzT6txHJoAxP@kroah.com>
Date: Thu, 19 May 2022 17:58:35 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Yongzhi Liu <lyz_cs@....edu.cn>
Cc: pawell@...ence.com, peter.chen@....com, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, fuyq@....pku.edu.cn
Subject: Re: [PATCH] usb: cdnsp: Fix potential dereference of NULL pointer
On Wed, May 18, 2022 at 09:35:43AM -0700, Yongzhi Liu wrote:
> The return value of cdnsp_get_transfer_ring()
> needs to be checked to avoid use of NULL pointer
> in case of an acquisition failure.
Please use the full 72 columns
>
> Fixes: 3d8290455 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
>
> Signed-off-by: Yongzhi Liu <lyz_cs@....edu.cn>
Please do not put a blank line between "Fixes:" and your signed off by
line.
> ---
> drivers/usb/cdns3/cdnsp-ring.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/cdns3/cdnsp-ring.c b/drivers/usb/cdns3/cdnsp-ring.c
> index 1b14384..9f206b9 100644
> --- a/drivers/usb/cdns3/cdnsp-ring.c
> +++ b/drivers/usb/cdns3/cdnsp-ring.c
> @@ -655,6 +655,8 @@ static int cdnsp_cmd_set_deq(struct cdnsp_device *pdev,
> * to reflect the new position.
> */
> ep_ring = cdnsp_get_transfer_ring(pdev, pep, deq_state->stream_id);
> + if (!ep_ring)
> + return -EINVAL;
How did you test this?
Don't you need to properly clean up and handle the hardware issues if
you exit early here?
Without good testing, I am loath to take this.
thanks,
greg k-h
Powered by blists - more mailing lists