summaryrefslogtreecommitdiffstats
path: root/common/console.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2013-09-16 19:49:58 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-09-19 08:49:47 +0200
commitbb89ea62a0b7e5c6fcedfe1a28b6dd82236247ce (patch)
tree45448d5807a24e8bd1b42e27994334e590763f2f /common/console.c
parent54385ace4b98f8131d53757d18858d0729960dc2 (diff)
downloadbarebox-bb89ea62a0b7e5c6fcedfe1a28b6dd82236247ce.tar.gz
barebox-bb89ea62a0b7e5c6fcedfe1a28b6dd82236247ce.tar.xz
login: disable input console if password wrong
so we guarantee that barebox is secured again user interaction Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/console.c b/common/console.c
index 6ca94e2a02..49318291db 100644
--- a/common/console.c
+++ b/common/console.c
@@ -236,6 +236,9 @@ int getc(void)
unsigned char ch;
uint64_t start;
+ if (unlikely(!console_is_input_allow()))
+ return -EPERM;
+
/*
* For 100us we read the characters from the serial driver
* into a kfifo. This helps us not to lose characters
@@ -270,6 +273,9 @@ EXPORT_SYMBOL(fgetc);
int tstc(void)
{
+ if (unlikely(!console_is_input_allow()))
+ return 0;
+
return kfifo_len(console_input_fifo) || tstc_raw();
}
EXPORT_SYMBOL(tstc);