From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Anastasia Belova <abelova@astralinux.ru>
Cc: Rob Springer <rspringer@google.com>,
Todd Poynor <toddpoynor@google.com>,
Ben Chan <benchan@chromium.org>, Richard Yeh <rcy@google.com>,
John Joseph <jnjoseph@google.com>, Simon Que <sque@chromium.org>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org
Subject: Re: [PATCH 5.10] gasket: make interrupt_data NULL after free
Date: Sun, 16 Jul 2023 17:20:18 +0200 [thread overview]
Message-ID: <2023071601-uncombed-stifling-bb3a@gregkh> (raw)
In-Reply-To: <20230707134712.7019-1-abelova@astralinux.ru>
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@astralinux.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
prev parent reply other threads:[~2023-07-16 15:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 13:47 [PATCH 5.10] gasket: make interrupt_data NULL after free Anastasia Belova
2023-07-16 15:20 ` Greg Kroah-Hartman [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=2023071601-uncombed-stifling-bb3a@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=abelova@astralinux.ru \
--cc=benchan@chromium.org \
--cc=jnjoseph@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=lvc-project@linuxtesting.org \
--cc=rcy@google.com \
--cc=rspringer@google.com \
--cc=sque@chromium.org \
--cc=toddpoynor@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.