https://bugs.gentoo.org/962830
https://sourceware.org/bugzilla/show_bug.cgi?id=33340#c22

From c24f68c1028b30364acb4ed085de15364fddbcb9 Mon Sep 17 00:00:00 2001
From: "H. Peter Anvin" <hpa@zytor.com>
Date: Wed, 10 Sep 2025 17:58:01 -0700
Subject: [PATCH 1/3] linux_termios: clear CIBAUD flags, too

In case the serial port was already set up with split speed, using one
of the standard speed constants (i.e. not BOTHER) it is necessary to
clear CIBAUD to revert back to single speed.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 linux_termios.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux_termios.c b/linux_termios.c
index 3630e5758ae3..0dd0b105726f 100644
--- a/linux_termios.c
+++ b/linux_termios.c
@@ -86,7 +86,7 @@ SP_PRIV void set_termios_speed(void *data, int speed)
 #else
 	struct termios *term = (struct termios *) data;
 #endif
-	term->c_cflag &= ~CBAUD;
+	term->c_cflag &= ~(CBAUD | CIBAUD);
 	term->c_cflag |= BOTHER;
 	term->c_ispeed = term->c_ospeed = speed;
 }
-- 
2.51.0
