[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2023071601-uncombed-stifling-bb3a@gregkh>
Date: Sun, 16 Jul 2023 17:20:18 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Anastasia Belova <abelova@...ralinux.ru>
Cc: Rob Springer <rspringer@...gle.com>,
Todd Poynor <toddpoynor@...gle.com>,
Ben Chan <benchan@...omium.org>, Richard Yeh <rcy@...gle.com>,
John Joseph <jnjoseph@...gle.com>,
Simon Que <sque@...omium.org>, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: Re: [PATCH 5.10] gasket: make interrupt_data NULL after free
On Fri, Jul 07, 2023 at 04:47:12PM +0300, Anastasia Belova wrote:
> Gasket common interrupt module was deleted in version 5.13,
> but there is possible double free in versions 4.19-5.12.
>
> gasket_dev->interrupt_data should be NULL when
> gasket_interrupt_init returns error. For example,
> it is necessary in gasket_enable_device to avoid
> double free.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 9a69f5087ccc ("drivers/staging: Gasket driver framework + Apex driver")
> Signed-off-by: Anastasia Belova <abelova@...ralinux.ru>
> ---
> drivers/staging/gasket/gasket_interrupt.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/staging/gasket/gasket_interrupt.c b/drivers/staging/gasket/gasket_interrupt.c
> index 864342acfd86..24fa5df0628b 100644
> --- a/drivers/staging/gasket/gasket_interrupt.c
> +++ b/drivers/staging/gasket/gasket_interrupt.c
> @@ -337,6 +337,7 @@ int gasket_interrupt_init(struct gasket_dev *gasket_dev)
> sizeof(*interrupt_data->eventfd_ctxs), GFP_KERNEL);
> if (!interrupt_data->eventfd_ctxs) {
> kfree(interrupt_data);
> + gasket_dev->interrupt_data = NULL;
> return -ENOMEM;
> }
>
> @@ -346,6 +347,7 @@ int gasket_interrupt_init(struct gasket_dev *gasket_dev)
> if (!interrupt_data->interrupt_counts) {
> kfree(interrupt_data->eventfd_ctxs);
> kfree(interrupt_data);
> + gasket_dev->interrupt_data = NULL;
> return -ENOMEM;
> }
>
> --
> 2.30.2
>
As this can never happen in real life, and no one is using this code,
I'm going to ignore this patch for now, sorry.
greg k-h
Powered by blists - more mailing lists