[CRIU] [PATCH 02/11] tty: Instead of BUG_ON exit out with error early

Cyrill Gorcunov gorcunov at openvz.org
Mon Oct 6 06:15:41 PDT 2014


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 tty.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tty.c b/tty.c
index 4e1e041fd9d1..bd8d21179667 100644
--- a/tty.c
+++ b/tty.c
@@ -238,8 +238,6 @@ static int tty_test_and_set(int bit, unsigned long *bitmap)
 {
 	int ret;
 
-	BUG_ON(bit > (MAX_TTYS << 1));
-
 	ret = test_bit(bit, bitmap);
 	if (!ret)
 		set_bit(bit, bitmap);
@@ -905,6 +903,9 @@ static int verify_info(struct tty_info *info)
 	    verify_termios(info->tfe->id, info->tie->termios))
 		return -1;
 
+	if (info->tie->termios && info->tfe->tty_info_id > (MAX_TTYS << 1))
+		return -1;
+
 	return 0;
 }
 
-- 
1.9.3



More information about the CRIU mailing list