[CRIU] [PATCH 2/2] tty: Fix false-positive failure if index of peer is zero

Cyrill Gorcunov gorcunov at openvz.org
Mon Dec 10 09:07:13 EST 2012


is_log2 helper has a corner case on [0;1] range which
we should honor.

Reported-by:Alexander Kartashov <alekskartashov at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tty.c b/tty.c
index 5f30d89..e4990d2 100644
--- a/tty.c
+++ b/tty.c
@@ -167,7 +167,7 @@ int tty_verify_active_pairs(void)
 	unsigned long i, unpaired_slaves = 0;
 
 	for_each_bit(i, tty_active_pairs) {
-		if (is_log2(i)) {
+		if (is_log2(i) && i != 1) {
 			if (test_bit(i + 1, tty_active_pairs)) {
 				i++;
 				continue;
-- 
1.8.0.1



More information about the CRIU mailing list