From: Greg KH <gregkh@linuxfoundation.org>
To: Yongzhi Liu <lyz_cs@pku.edu.cn>
Cc: peter.chen@kernel.org, pawell@cadence.com, rogerq@kernel.org,
a-govindraju@ti.com, felipe.balbi@linux.intel.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
fuyq@stu.pku.edu.cn
Subject: Re: [PATCH] usb: cdns3: Fix potential dereference of NULL pointer
Date: Thu, 19 May 2022 18:07:17 +0200 [thread overview]
Message-ID: <YoZrNRf5W4hLdy9N@kroah.com> (raw)
In-Reply-To: <1652861570-102489-1-git-send-email-lyz_cs@pku.edu.cn>
On Wed, May 18, 2022 at 01:12:50AM -0700, Yongzhi Liu wrote:
> The return value of cdns3_gadget_ep_alloc_request()
> needs to be checked to avoid use of NULL pointer
> in case of an allocation failure.
>
> Fixes: 7733f6c32e36f ("usb: cdns3: Add Cadence USB3 DRD Driver")
>
> Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn>
Again, no blank line and use the full width for your text.
> ---
> drivers/usb/cdns3/cdns3-gadget.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index 5d8c982..7be328e 100644
> --- a/drivers/usb/cdns3/cdns3-gadget.c
> +++ b/drivers/usb/cdns3/cdns3-gadget.c
> @@ -2568,6 +2568,10 @@ static int cdns3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
> struct cdns3_request *priv_req;
>
> zlp_request = cdns3_gadget_ep_alloc_request(ep, GFP_ATOMIC);
> + if (!zlp_request) {
> + ret = -ENOMEM;
> + goto err;
> + }
How did you test this that the if the allocation fails this will clean
up properly?
thanks,
greg k-h
next prev parent reply other threads:[~2022-05-19 16:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 8:12 [PATCH] usb: cdns3: Fix potential dereference of NULL pointer Yongzhi Liu
2022-05-19 16:07 ` Greg KH [this message]
2022-05-19 17:15 ` 刘永志
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=YoZrNRf5W4hLdy9N@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=a-govindraju@ti.com \
--cc=felipe.balbi@linux.intel.com \
--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@kernel.org \
--cc=rogerq@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox