From: "Samuel Iglesias Gonsálvez" <siglesias@igalia.com>
To: Lv Yunlong <lyl2019@mail.ustc.edu.cn>,
jens.taprogge@taprogge.org, gregkh@linuxfoundation.org
Cc: industrypack-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe
Date: Wed, 26 May 2021 12:04:28 +0200 [thread overview]
Message-ID: <c00938c1e634340663e145b51c5989bd4a20f326.camel@igalia.com> (raw)
In-Reply-To: <20210524093205.8333-1-lyl2019@mail.ustc.edu.cn>
[-- Attachment #1: Type: text/plain, Size: 1747 bytes --]
Hi Lv,
Thanks for the patch!
Patch is,
Acked-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Greg, Would you mind picking this patch series through your char-misc
tree?
Thanks!
Sam
On Mon, 2021-05-24 at 02:32 -0700, Lv Yunlong wrote:
> In the out_err_bus_register error branch of tpci200_pci_probe,
> tpci200->info->cfg_regs is freed by tpci200_uninstall()->
> tpci200_unregister()->pci_iounmap(..,tpci200->info->cfg_regs)
> in the first time.
>
> But later, iounmap() is called to free tpci200->info->cfg_regs
> again.
>
> My patch sets tpci200->info->cfg_regs to NULL after
> tpci200_uninstall()
> to avoid the double free.
>
> Fixes: cea2f7cdff2af ("Staging: ipack/bridges/tpci200: Use the
> TPCI200 in big endian mode")
> Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
> ---
> drivers/ipack/carriers/tpci200.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ipack/carriers/tpci200.c
> b/drivers/ipack/carriers/tpci200.c
> index ec71063fff76..e1822e87ec3d 100644
> --- a/drivers/ipack/carriers/tpci200.c
> +++ b/drivers/ipack/carriers/tpci200.c
> @@ -596,8 +596,11 @@ static int tpci200_pci_probe(struct pci_dev
> *pdev,
>
> out_err_bus_register:
> tpci200_uninstall(tpci200);
> + /* tpci200->info->cfg_regs is unmapped in tpci200_uninstall
> */
> + tpci200->info->cfg_regs = NULL;
> out_err_install:
> - iounmap(tpci200->info->cfg_regs);
> + if (tpci200->info->cfg_regs)
> + iounmap(tpci200->info->cfg_regs);
> out_err_ioremap:
> pci_release_region(pdev, TPCI200_CFG_MEM_BAR);
> out_err_pci_request:
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-05-26 10:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-24 9:32 Lv Yunlong
2021-05-26 10:04 ` Samuel Iglesias Gonsálvez [this message]
2021-05-27 12:39 ` Greg KH
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=c00938c1e634340663e145b51c5989bd4a20f326.camel@igalia.com \
--to=siglesias@igalia.com \
--cc=gregkh@linuxfoundation.org \
--cc=industrypack-devel@lists.sourceforge.net \
--cc=jens.taprogge@taprogge.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lyl2019@mail.ustc.edu.cn \
/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
all inboxes | Powered by JetHome®