From: Greg KH <gregkh@linuxfoundation.org>
To: Yongzhi Liu <lyz_cs@pku.edu.cn>
Cc: pawell@cadence.com, peter.chen@nxp.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
fuyq@stu.pku.edu.cn
Subject: Re: [PATCH] usb: cdnsp: Fix potential dereference of NULL pointer
Date: Thu, 19 May 2022 17:58:35 +0200 [thread overview]
Message-ID: <YoZpKzT6txHJoAxP@kroah.com> (raw)
In-Reply-To: <1652891743-110930-1-git-send-email-lyz_cs@pku.edu.cn>
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@pku.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
next prev parent reply other threads:[~2022-05-19 15:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 16:35 [PATCH] usb: cdnsp: Fix potential dereference of NULL pointer Yongzhi Liu
2022-05-19 15:58 ` Greg KH [this message]
2022-05-19 17:10 ` 刘永志
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YoZpKzT6txHJoAxP@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=fuyq@stu.pku.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lyz_cs@pku.edu.cn \
--cc=pawell@cadence.com \
--cc=peter.chen@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.