From: Fabian Pflug <f.pflug@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Fabian Pflug <f.pflug@pengutronix.de>
Subject: [PATCH v2 2/3] console_common: get_first_active: respect security policy
Date: Tue, 28 Oct 2025 16:43:26 +0100 [thread overview]
Message-ID: <20251028154453.2990491-3-f.pflug@pengutronix.de> (raw)
In-Reply-To: <20251028154453.2990491-1-f.pflug@pengutronix.de>
If the console input is deactivated through a security policy, then
there is no need to iterate over the current consoles, as none should
have a STDIN.
Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
---
v2:
Fix in console common instead of working around it in startup.c
common/console_common.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/common/console_common.c b/common/console_common.c
index 5b7a64c99c..a8319c20f3 100644
--- a/common/console_common.c
+++ b/common/console_common.c
@@ -23,6 +23,7 @@
#include <linux/math64.h>
#include <linux/sizes.h>
#include <linux/overflow.h>
+#include <security/config.h>
#ifndef CONFIG_CONSOLE_NONE
@@ -331,6 +332,11 @@ struct console_device *console_get_first_active(void)
{
struct console_device *cdev;
const unsigned char active = CONSOLE_STDIN | CONSOLE_STDOUT;
+
+ /* if no console input is allows, then we can't have STDIN on any. */
+ if (!IS_ALLOWED(SCONFIG_CONSOLE_INPUT))
+ return NULL;
+
/*
* Assumption to have BOTH CONSOLE_STDIN AND STDOUT in the
* same output console
--
2.47.3
next prev parent reply other threads:[~2025-10-28 15:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 15:43 [PATCH v2 1/3] startup: check for console before showing menu Fabian Pflug
2025-10-28 15:43 ` Fabian Pflug [this message]
2025-10-29 7:04 ` [PATCH v2 2/3] console_common: get_first_active: respect security policy Ahmad Fatoum
2025-10-28 15:43 ` [PATCH 3/3] startup: mount ps only on policy FS_EXTERNAL Fabian Pflug
2025-10-29 9:06 ` [PATCH v2 1/3] startup: check for console before showing menu Sascha Hauer
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=20251028154453.2990491-3-f.pflug@pengutronix.de \
--to=f.pflug@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