From: Markus Elfring <Markus.Elfring@web.de>
To: kernel-janitors@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Michael Ellerman <mpe@ellerman.id.au>,
Nathan Lynch <nathanl@linux.ibm.com>,
Nicholas Piggin <npiggin@gmail.com>,
Paul Moore <paul@paul-moore.com>
Cc: LKML <linux-kernel@vger.kernel.org>, cocci@inria.fr
Subject: [PATCH v2 1/2] powerpc/pseries: Do not pass an error pointer to of_node_put() in pSeries_reconfig_add_node()
Date: Tue, 21 Mar 2023 11:33:56 +0100 [thread overview]
Message-ID: <8949eefb-30d3-3c51-4f03-4a3c6f1b15dc@web.de> (raw)
In-Reply-To: <d4bcde15-b4f1-0e98-9072-3153d1bd21bc@web.de>
Date: Tue, 21 Mar 2023 10:30:23 +0100
It can be determined in the implementation of the function
“pSeries_reconfig_add_node” that an error code would occasionally
be provided by a call of a function like pseries_of_derive_parent().
This error indication was passed to an of_node_put() call according to
an attempt for exception handling so far.
Thus fix the risk for undesirable software behaviour by using
an additional label for this error case.
Link: https://lists.ozlabs.org/pipermail/linuxppc-dev/2023-March/256025.html
Link: https://lore.kernel.org/lkml/87pm9377qt.fsf@linux.ibm.com/
Reported-by: Nathan Lynch <nathanl@linux.ibm.com>
Fixes: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 ("Linux-2.6.12-rc2")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
V2:
This update step was added according to another change request.
arch/powerpc/platforms/pseries/reconfig.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 599bd2c78514..44f8ebc2ec0d 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -40,7 +40,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
np->parent = pseries_of_derive_parent(path);
if (IS_ERR(np->parent)) {
err = PTR_ERR(np->parent);
- goto out_err;
+ goto free_name;
}
err = of_attach_node(np);
@@ -56,6 +56,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
out_err:
if (np) {
of_node_put(np->parent);
+free_name:
kfree(np->full_name);
kfree(np);
}
--
2.40.0
next prev parent reply other threads:[~2023-03-21 10:36 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <f9303bdc-b1a7-be5e-56c6-dfa8232b8b55@web.de>
2023-03-16 20:07 ` [PATCH 0/4] powerpc/4xx: Adjustments for four function implementations Markus Elfring
2023-03-16 20:10 ` [PATCH 1/4] powerpc/4xx: Fix exception handling in ppc4xx_pciex_port_setup_hose() Markus Elfring
2023-03-16 20:14 ` [PATCH 2/4] powerpc/4xx: Fix exception handling in ppc4xx_probe_pcix_bridge() Markus Elfring
2023-03-16 20:16 ` [PATCH 3/4] powerpc/4xx: Fix exception handling in ppc4xx_probe_pci_bridge() Markus Elfring
2023-03-16 20:18 ` [PATCH 4/4] powerpc/4xx: Delete unnecessary variable initialisations in four functions Markus Elfring
2023-03-25 15:30 ` [PATCH v2 0/4] powerpc/4xx: Adjustments for four function implementations Markus Elfring
2023-03-25 15:36 ` [PATCH v2 1/4] powerpc/4xx: Fix exception handling in ppc4xx_pciex_port_setup_hose() Markus Elfring
2023-03-25 15:38 ` [PATCH v2 2/4] powerpc/4xx: Fix exception handling in ppc4xx_probe_pcix_bridge() Markus Elfring
2023-03-25 15:40 ` [PATCH v2 3/4] powerpc/4xx: Fix exception handling in ppc4xx_probe_pci_bridge() Markus Elfring
2023-03-25 15:42 ` [PATCH v2 4/4] powerpc/4xx: Delete unnecessary variable initialisations in four functions Markus Elfring
2024-01-05 17:42 ` [PATCH v2 0/4] powerpc/4xx: Adjustments for four function implementations Markus Elfring
2023-03-17 8:50 ` [PATCH] powerpc/pseries: Fix exception handling in pSeries_reconfig_add_node() Markus Elfring
2023-03-17 13:11 ` Nathan Lynch
2023-03-17 14:20 ` Markus Elfring
2023-03-17 15:41 ` Nathan Lynch
2023-03-18 7:30 ` Markus Elfring
2023-03-20 15:38 ` Nathan Lynch
2023-03-21 6:54 ` Markus Elfring
2023-03-21 10:30 ` [PATCH v2 0/2] powerpc/pseries: Fixes for " Markus Elfring
2023-03-21 10:33 ` Markus Elfring [this message]
2023-03-21 10:36 ` [PATCH v2 2/2] powerpc/pseries: Fix " Markus Elfring
2023-03-25 13:40 ` [PATCH resent v2 0/2] powerpc/pseries: Fixes for " Markus Elfring
2023-03-25 13:42 ` [PATCH resent v2 1/2] powerpc/pseries: Do not pass an error pointer to of_node_put() " Markus Elfring
2023-03-25 13:44 ` [PATCH resent v2 2/2] powerpc/pseries: Fix exception handling " Markus Elfring
2024-01-05 17:19 ` [PATCH resent v2 0/2] powerpc/pseries: Fixes for " Markus Elfring
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=8949eefb-30d3-3c51-4f03-4a3c6f1b15dc@web.de \
--to=markus.elfring@web.de \
--cc=christophe.leroy@csgroup.eu \
--cc=cocci@inria.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=nathanl@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=paul@paul-moore.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;
as well as URLs for NNTP newsgroup(s).