From: Dan Carpenter <dan.carpenter@linaro.org>
To: Torsten Hilbrich <torsten.hilbrich@secunet.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Sasha Levin <sashal@kernel.org>,
linux-input@vger.kernel.org,
Brad Spengler <spender@grsecurity.net>
Subject: Re: v6.8-rc4: Crash in rmi_unregister_function still present
Date: Wed, 21 Feb 2024 10:15:20 +0300 [thread overview]
Message-ID: <3401abdc-32c5-4b88-8edf-75d4683d4be0@moroto.mountain> (raw)
In-Reply-To: <1932038e-2776-04ac-5fcd-b15bb3cd088d@secunet.com>
On Wed, Feb 21, 2024 at 07:55:40AM +0100, Torsten Hilbrich wrote:
> Hello,
>
> updating our codebase to v6.8-rc4 which contains:
>
> eb988e46da2e Input: synaptics-rmi4 - fix use after free in rmi_unregister_function()
>
> I noticed that the previously noticed crash in the rmi4 was present again.
>
> Previously, we were using a fix from the grsecurity codebase which changed the function in the following way:
>
> void rmi_unregister_function(struct rmi_function *fn)
> {
> int i;
>
> rmi_dbg(RMI_DEBUG_CORE, &fn->dev, "Unregistering F%02X.\n",
> fn->fd.function_number);
>
> for (i = 0; i < fn->num_of_irqs; i++)
> irq_dispose_mapping(fn->irq[i]);
>
> device_del(&fn->dev);
> of_node_put(fn->dev.of_node);
> put_device(&fn->dev);
> }
>
> With this version of the fix the crash didn't happen. Please note, that the crash happens in device_del which is before the irq_dispose_mapping call in eb988e46da2e.
>
> Attached is a kernel log from the crash with a kernel based on v6.8-rc4.
Hi Torsten,
Thanks for the bug report. The truth is that I don't really understand
how IRQ mappings work. It would be simple enough to apply the same
fix that grsecurity does. The only question how to assign authorship
credit. Dmitry, how do you want to handle this?
regards,
dan carpenter
diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
index 1b45b1d3077d..02acc81b9d3e 100644
--- a/drivers/input/rmi4/rmi_bus.c
+++ b/drivers/input/rmi4/rmi_bus.c
@@ -275,12 +275,11 @@ void rmi_unregister_function(struct rmi_function *fn)
rmi_dbg(RMI_DEBUG_CORE, &fn->dev, "Unregistering F%02X.\n",
fn->fd.function_number);
- device_del(&fn->dev);
- of_node_put(fn->dev.of_node);
-
for (i = 0; i < fn->num_of_irqs; i++)
irq_dispose_mapping(fn->irq[i]);
+ device_del(&fn->dev);
+ of_node_put(fn->dev.of_node);
put_device(&fn->dev);
}
next prev parent reply other threads:[~2024-02-21 7:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 6:55 v6.8-rc4: Crash in rmi_unregister_function still present Torsten Hilbrich
2024-02-21 7:15 ` Dan Carpenter [this message]
2024-02-21 7:24 ` Torsten Hilbrich
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=3401abdc-32c5-4b88-8edf-75d4683d4be0@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=spender@grsecurity.net \
--cc=torsten.hilbrich@secunet.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