* [PATCH] serial: core: fix OF node leak
@ 2025-07-08 8:58 Johan Hovold
2025-07-08 13:37 ` Aidan Stewart
0 siblings, 1 reply; 4+ messages in thread
From: Johan Hovold @ 2025-07-08 8:58 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Jiri Slaby, Aidan Stewart, linux-serial, linux-kernel,
Johan Hovold
Make sure to drop the OF node reference taken when initialising the
control and port devices when the devices are later released.
Fixes: d36f0e9a0002 ("serial: core: restore of_node information in sysfs")
Cc: Aidan Stewart <astewart@tektelic.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/tty/serial/serial_base_bus.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/tty/serial/serial_base_bus.c b/drivers/tty/serial/serial_base_bus.c
index cb3b127b06b6..22749ab0428a 100644
--- a/drivers/tty/serial/serial_base_bus.c
+++ b/drivers/tty/serial/serial_base_bus.c
@@ -13,6 +13,7 @@
#include <linux/device.h>
#include <linux/idr.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/serial_core.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -93,6 +94,7 @@ static void serial_base_ctrl_release(struct device *dev)
{
struct serial_ctrl_device *ctrl_dev = to_serial_base_ctrl_device(dev);
+ of_node_put(dev->of_node);
kfree(ctrl_dev);
}
@@ -140,6 +142,7 @@ static void serial_base_port_release(struct device *dev)
{
struct serial_port_device *port_dev = to_serial_base_port_device(dev);
+ of_node_put(dev->of_node);
kfree(port_dev);
}
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: core: fix OF node leak
2025-07-08 8:58 [PATCH] serial: core: fix OF node leak Johan Hovold
@ 2025-07-08 13:37 ` Aidan Stewart
2025-07-08 15:23 ` Johan Hovold
0 siblings, 1 reply; 4+ messages in thread
From: Aidan Stewart @ 2025-07-08 13:37 UTC (permalink / raw)
To: Johan Hovold, Greg Kroah-Hartman
Cc: Jiri Slaby, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
Hi Johan,
On Tue, 2025-07-08 at 10:58 +0200, Johan Hovold wrote:
>
>
> CAUTION: This email originated from outside the organization. Do not
> click links or open attachments unless you recognize the sender and know
> the content is safe.
>
>
>
> Make sure to drop the OF node reference taken when initialising the
> control and port devices when the devices are later released.
>
> Fixes: d36f0e9a0002 ("serial: core: restore of_node information in
> sysfs")
> Cc: Aidan Stewart <astewart@tektelic.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/tty/serial/serial_base_bus.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/tty/serial/serial_base_bus.c
> b/drivers/tty/serial/serial_base_bus.c
> index cb3b127b06b6..22749ab0428a 100644
> --- a/drivers/tty/serial/serial_base_bus.c
> +++ b/drivers/tty/serial/serial_base_bus.c
> @@ -13,6 +13,7 @@
> #include <linux/device.h>
> #include <linux/idr.h>
> #include <linux/module.h>
> +#include <linux/of.h>
> #include <linux/serial_core.h>
> #include <linux/slab.h>
> #include <linux/spinlock.h>
> @@ -93,6 +94,7 @@ static void serial_base_ctrl_release(struct device
> *dev)
> {
> struct serial_ctrl_device *ctrl_dev =
> to_serial_base_ctrl_device(dev);
>
> + of_node_put(dev->of_node);
> kfree(ctrl_dev);
> }
>
> @@ -140,6 +142,7 @@ static void serial_base_port_release(struct device
> *dev)
> {
> struct serial_port_device *port_dev =
> to_serial_base_port_device(dev);
>
> + of_node_put(dev->of_node);
> kfree(port_dev);
> }
>
> --
> 2.49.0
Thanks for the fix. I think this also needs to go into -stable, as the
previous changes have already landed there (6.12.36 and 6.15.5).
Aidan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: core: fix OF node leak
2025-07-08 13:37 ` Aidan Stewart
@ 2025-07-08 15:23 ` Johan Hovold
2025-07-08 15:26 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Johan Hovold @ 2025-07-08 15:23 UTC (permalink / raw)
To: Aidan Stewart
Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
On Tue, Jul 08, 2025 at 01:37:45PM +0000, Aidan Stewart wrote:
> On Tue, 2025-07-08 at 10:58 +0200, Johan Hovold wrote:
> > Make sure to drop the OF node reference taken when initialising the
> > control and port devices when the devices are later released.
> >
> > Fixes: d36f0e9a0002 ("serial: core: restore of_node information in
> > sysfs")
> > Cc: Aidan Stewart <astewart@tektelic.com>
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> Thanks for the fix. I think this also needs to go into -stable, as the
> previous changes have already landed there (6.12.36 and 6.15.5).
I left out the stable tag on purpose since this leak should not cause
trouble as, for example, these devices are typically registered at boot
and never deregistered.
It fixes an issue introduced in rc4 so it should preferably still go
into 6.16-final, though.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: core: fix OF node leak
2025-07-08 15:23 ` Johan Hovold
@ 2025-07-08 15:26 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2025-07-08 15:26 UTC (permalink / raw)
To: Johan Hovold
Cc: Aidan Stewart, Jiri Slaby, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
On Tue, Jul 08, 2025 at 05:23:38PM +0200, Johan Hovold wrote:
> On Tue, Jul 08, 2025 at 01:37:45PM +0000, Aidan Stewart wrote:
> > On Tue, 2025-07-08 at 10:58 +0200, Johan Hovold wrote:
>
> > > Make sure to drop the OF node reference taken when initialising the
> > > control and port devices when the devices are later released.
> > >
> > > Fixes: d36f0e9a0002 ("serial: core: restore of_node information in
> > > sysfs")
> > > Cc: Aidan Stewart <astewart@tektelic.com>
> > > Signed-off-by: Johan Hovold <johan@kernel.org>
>
> > Thanks for the fix. I think this also needs to go into -stable, as the
> > previous changes have already landed there (6.12.36 and 6.15.5).
>
> I left out the stable tag on purpose since this leak should not cause
> trouble as, for example, these devices are typically registered at boot
> and never deregistered.
>
> It fixes an issue introduced in rc4 so it should preferably still go
> into 6.16-final, though.
Ok, will get this merged, thanks!
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-07-08 15:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-08 8:58 [PATCH] serial: core: fix OF node leak Johan Hovold
2025-07-08 13:37 ` Aidan Stewart
2025-07-08 15:23 ` Johan Hovold
2025-07-08 15:26 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).