FAILED: patch "[PATCH] irqdomain: Fixed unbalanced fwnode get and put" failed to apply to 5.4-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y
git checkout FETCH_HEAD
git cherry-pick -x 6ce3e98184b625d2870991880bf9586ded7ea7f9
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024073029-each-sprung-4744@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^..
Possible dependencies:
6ce3e98184b6 ("irqdomain: Fixed unbalanced fwnode get and put") 67a4e1a3bf7c ("irqdomain: Use return value of strreplace()") ed1054a02aa2 ("irqdomain: Mark fwnodes when their irqdomain is added/removed") 181e9d4efaf6 ("irqdomain: Make __irq_domain_add() less OF-dependent")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 6ce3e98184b625d2870991880bf9586ded7ea7f9 Mon Sep 17 00:00:00 2001
From: Herve Codina <[email protected]>
Date: Fri, 14 Jun 2024 19:32:04 +0200
Subject: [PATCH] irqdomain: Fixed unbalanced fwnode get and put
fwnode_handle_get(fwnode) is called when a domain is created with fwnode passed as a function parameter. fwnode_handle_put(domain->fwnode) is called when the domain is destroyed but during the creation a path exists that does not set domain->fwnode.
If this path is taken, the fwnode get will never be put.
To avoid the unbalanced get and put, set domain->fwnode unconditionally.
kernel/irq/irqdomain.c +2 -5
@@ -156,7 +156,6 @@ static struct irq_domain *__irq_domain_create(struct fwnode_handle *fwnode,switch (fwid->type) {case IRQCHIP_FWNODE_NAMED :case IRQCHIP_FWNODE_NAMED_ID : - domain->fwnode = fwnode; domain->name =kstrdup (fwid->name,GFP_KERNEL );if (!domain->name) {kfree (domain);
@@ -165,7 +164,6 @@ static struct irq_domain *__irq_domain_create(struct fwnode_handle *fwnode, domain->flags |=IRQ_DOMAIN_NAME_ALLOCATED ;break ;default : - domain->fwnode = fwnode; domain->name = fwid->name;break ; }
@@ -185,7 +183,6 @@ static struct irq_domain *__irq_domain_create(struct fwnode_handle *fwnode, } domain->name =strreplace (name,'/' ,':' ); - domain->fwnode = fwnode; domain->flags |=IRQ_DOMAIN_NAME_ALLOCATED ; }
@@ -201,8 +198,8 @@ static struct irq_domain *__irq_domain_create(struct fwnode_handle *fwnode, domain->flags |=IRQ_DOMAIN_NAME_ALLOCATED ; } -fwnode_handle_get (fwnode); -fwnode_dev_initialized (fwnode, true); + domain->fwnode =fwnode_handle_get (fwnode); +fwnode_dev_initialized (domain->fwnode, true);/* Fill structure */ INIT_RADIX_TREE (&domain->revmap_tree,GFP_KERNEL );