From: Dan Carpenter <dan.carpenter@oracle.com>
To: Pawel Laszczak <pawell@cadence.com>
Cc: peter.chen@nxp.com, linux-usb@vger.kernel.org,
gregkh@linuxfoundation.org, kurahul@cadence.com
Subject: Re: [PATCH] usb: cdnsp: fix error handling in cdnsp_mem_init()
Date: Fri, 11 Dec 2020 13:58:37 +0300 [thread overview]
Message-ID: <20201211105837.GT2789@kadam> (raw)
In-Reply-To: <20201211095053.1948-1-pawell@cadence.com>
On Fri, Dec 11, 2020 at 10:50:53AM +0100, Pawel Laszczak wrote:
> This function uses "One Function Cleans up Everything" style and that's
> basically impossible to do correctly. It's cleaner to write it with
> "clean up the most recent allocation".
>
> Patch fixes two isues:
> 1. If pdev->dcbaa = dma_alloc_coherent() fails then that leads to a NULL
> dereference inside the cdnsp_free_priv_device() function.
> 2. if cdnsp_alloc_priv_device() fails that leads to a double free because
> we free pdev->out_ctx.bytes in several places.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Tested-by: Pawel Laszczak <pawell@cadence.com>
Thanks so much!
regards,
dan carpenter
next prev parent reply other threads:[~2020-12-11 11:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 9:50 [PATCH] usb: cdnsp: fix error handling in cdnsp_mem_init() Pawel Laszczak
2020-12-11 10:58 ` Dan Carpenter [this message]
2020-12-28 14:43 ` Greg KH
2021-01-11 6:49 ` Pawel Laszczak
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=20201211105837.GT2789@kadam \
--to=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=kurahul@cadence.com \
--cc=linux-usb@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).