On Fri, Dec 15, 2023 at 04:28:53PM +0800, Zijun Hu wrote: > 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. What specific security issue are you referring to here? > Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx> > --- > 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) I'm missing something, why change this? Remember if tty_ldisc_autoload is enabled, then any user can auto-load a tty ldisc, permissions are not needed. as it's confusing to read, let me break this down to see if the original code is correct or not: If you do NOT have CAP_SYS_MODULE AND you do NOT have tty_ldisc_autoload enabled, then the kernel will NOT call request_module If you do have CAP_SYS_MODULE enabled then the kernel will call request_module() If you do have tty_ldisc_autoload enabled, then you can autoload a module. Is this not the correct functionality? You are changing this to: If you do NOT have CAP_SYS_MODULE enabled, then no matter what, do NOT call request_module() If you do NOT have tty_ldisc_autoload enabled, then no matter what, do NOT call request_module() Are you sure that's what you want to change this to? What am I missing here? confused, greg "boolean logic is hard" k-h