[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023051542-attendee-subsidize-349f@gregkh>
Date: Mon, 15 May 2023 14:33:49 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Esina Ekaterina <eesina@...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] staging: gasket: interrupt: Clean interrupt_data
after free
On Mon, May 15, 2023 at 03:29:50PM +0300, Esina Ekaterina wrote:
> Add interrupt_data = NULL after kfree(interrupt_data) in
> gasket_interrupt_init. It is needed to avoid double free
> in gasket_interrupt_cleanup, there is a check for NULL
> before kfree(interrupt_data).
>
> Found by Astra Linux on behalf of Linux Verification Center
> (linuxtesting.org) with SVACE.
>
> Fixes: 9a69f5087ccc ("drivers/staging: Gasket driver framework + Apex driver")
> Signed-off-by: Esina Ekaterina <eesina@...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..48b664b9134a 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);
> + 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);
> + interrupt_data = NULL;
> return -ENOMEM;
> }
>
> --
> 2.40.1
>
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
Powered by blists - more mailing lists