Re: [PATCH 1/2] tty: ldisc: Fix misuse of proc_dointvec "ldisc_autoload"

From: Greg KH
Date: Mon Jun 24 2019 - 23:53:54 EST


On Tue, Jun 25, 2019 at 12:08:00PM +0900, Eiichi Tsukata wrote:
> /proc/sys/dev/tty/ldisc_autoload assumes given value to be 0 or 1. Use
> proc_dointvec_minmax instead of proc_dointvec.
>
> Fixes: 7c0cca7c847e "(tty: ldisc: add sysctl to prevent autoloading of ldiscs)"
> Signed-off-by: Eiichi Tsukata <devel@xxxxxxxxxxxx>
> ---
> 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 e38f104db174..a8ea7a35c94e 100644
> --- a/drivers/tty/tty_ldisc.c
> +++ b/drivers/tty/tty_ldisc.c
> @@ -863,7 +863,7 @@ static struct ctl_table tty_table[] = {
> .data = &tty_ldisc_autoload,
> .maxlen = sizeof(tty_ldisc_autoload),
> .mode = 0644,
> - .proc_handler = proc_dointvec,
> + .proc_handler = proc_dointvec_minmax,
> .extra1 = &zero,
> .extra2 = &one,

Ah, nice catch. But this really isn't an issue as if you use a bigger
value, things will not "break", right?

thanks,

greg k-h