Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH v1] tty: Fix a security issue related to tty-ldisc module loading
@ 2023-12-15  8:28 Zijun Hu
  2023-12-15  8:43 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Zijun Hu @ 2023-12-15  8:28 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: quic_zijuhu, linux-serial

Function tty_ldisc_get() has a simple logical error and may cause tty-ldisc
module to be loaded by a user without CAP_SYS_MODULE, this security issue
is fixed by correcting the logical error.

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
 drivers/tty/tty_ldisc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 3f68e213df1f..b490c0adf00f 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -150,7 +150,7 @@ static struct tty_ldisc *tty_ldisc_get(struct tty_struct *tty, int disc)
 	 */
 	ldops = get_ldops(disc);
 	if (IS_ERR(ldops)) {
-		if (!capable(CAP_SYS_MODULE) && !tty_ldisc_autoload)
+		if (!capable(CAP_SYS_MODULE) || !tty_ldisc_autoload)
 			return ERR_PTR(-EPERM);
 		request_module("tty-ldisc-%d", disc);
 		ldops = get_ldops(disc);
-- 
The Qualcomm Innovation Center


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-15 10:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-15  8:28 [PATCH v1] tty: Fix a security issue related to tty-ldisc module loading Zijun Hu
2023-12-15  8:43 ` Greg KH
2023-12-15  9:32   ` quic_zijuhu
2023-12-15 10:38     ` Greg KH
2023-12-15 10:45       ` quic_zijuhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox