From: Greg KH <gregkh@linuxfoundation.org>
To: Yi Yang <yiyang13@huawei.com>
Cc: kees@kernel.org, justinstitt@google.com,
u.kleine-koenig@baylibre.com, yuxu@marvell.com, balbi@ti.com,
linux-usb@vger.kernel.org, wangweiyang2@huawei.com
Subject: Re: [PATCH] usb: gadget: udc: fix possible null-ptr-deref in mv_u3d_req_to_trb()
Date: Tue, 29 Oct 2024 04:36:40 +0100 [thread overview]
Message-ID: <2024102928-chemicals-compost-d995@gregkh> (raw)
In-Reply-To: <20241026102740.2653458-1-yiyang13@huawei.com>
On Sat, Oct 26, 2024 at 10:27:40AM +0000, Yi Yang wrote:
> The mv_u3d_build_trb_one() will return NULL when kzalloc() fails, fix
> possible null-ptr-deref by add check for mv_u3d_build_trb_one().
>
> Fixes: 3d4eb9dfa3e8 ("usb: gadget: mv: Add USB 3.0 device driver for Marvell PXA2128 chip.")
> Signed-off-by: Yi Yang <yiyang13@huawei.com>
> ---
> drivers/usb/gadget/udc/mv_u3d_core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c
> index 062f43e146aa..c882c377c4f4 100644
> --- a/drivers/usb/gadget/udc/mv_u3d_core.c
> +++ b/drivers/usb/gadget/udc/mv_u3d_core.c
> @@ -417,6 +417,8 @@ static int mv_u3d_req_to_trb(struct mv_u3d_req *req)
> */
> if (length <= (unsigned)MV_U3D_EP_MAX_LENGTH_TRANSFER) {
> trb = mv_u3d_build_trb_one(req, &count, &dma);
> + if (!trb)
> + return -ENOMEM;
> list_add_tail(&trb->trb_list, &req->trb_list);
> req->trb_head = trb;
> req->trb_count = 1;
> --
> 2.25.1
>
>
How was this tested to verify it works properly?
thanks,.
greg k-h
prev parent reply other threads:[~2024-10-29 3:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-26 10:27 [PATCH] usb: gadget: udc: fix possible null-ptr-deref in mv_u3d_req_to_trb() Yi Yang
2024-10-29 3:36 ` Greg KH [this message]
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=2024102928-chemicals-compost-d995@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=balbi@ti.com \
--cc=justinstitt@google.com \
--cc=kees@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
--cc=wangweiyang2@huawei.com \
--cc=yiyang13@huawei.com \
--cc=yuxu@marvell.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox