mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] ARM: layerscape: ppa: Fix use after free
Date: Wed, 11 Nov 2020 15:10:12 +0100	[thread overview]
Message-ID: <20201111141012.6278-1-s.hauer@pengutronix.de> (raw)

In of_psci_do_fixup() we want to delete the one job-ring device node
which is used by the PPA secure firmware. When we have deleted the node
we may not continue the for_each_compatible_node_from() loop, because
that would derefence the just deleted node.
We only want to delete a single node, so we do not need to continue the
loop once we've found the node, so we can fix the issue by breaking out
of the loop.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-layerscape/ppa.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-layerscape/ppa.c b/arch/arm/mach-layerscape/ppa.c
index 6ab7659be7..c34651f39f 100644
--- a/arch/arm/mach-layerscape/ppa.c
+++ b/arch/arm/mach-layerscape/ppa.c
@@ -43,6 +43,7 @@ static int of_psci_do_fixup(struct device_node *root, void *unused)
 			continue;
 
 		of_delete_node(np);
+		break;
 	}
 
 	return of_psci_fixup(root, psci_version);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2020-11-11 14:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20201111141012.6278-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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