Skip to contentSkip to conversation

tty: ldisc: Fix misuse of proc_dointvec "ldisc_autoload"

PATCH Applied Eiichi Tsukata 3 participants 5 messages Jun 25, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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

/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)"
---
 drivers/tty/tty_ldisc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/tty_ldisc.c +1 -1
index e38f104db174..a8ea7a35c94e 100644
@@ -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,
 	},
Signature · 1 line
2.21.0
#1 lore raw

PATCH 2/2 net/ipv6: Fix misuse of proc_dointvec "skip_notify_on_dev_down"

/proc/sys/net/ipv6/route/skip_notify_on_dev_down assumes given value to be 0 or 1. Use proc_dointvec_minmax instead of proc_dointvec.

Fixes 7c6bb7d2faaf ("net/ipv6: Add knob to skip DELROUTE message ondevice down")
---
 net/ipv6/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/route.c +1 -1
index 11ad62effd56..aade636c6be6 100644
@@ -5281,7 +5281,7 @@ static struct ctl_table ipv6_route_table_template[] = {
 		.data		=	&init_net.ipv6.sysctl.skip_notify_on_dev_down,
 		.maxlen		=	sizeof(int),
 		.mode		=	0644,
-		.proc_handler	=	proc_dointvec,
+		.proc_handler	=	proc_dointvec_minmax,
 		.extra1		=	&zero,
 		.extra2		=	&one,
 	},
Signature · 1 line
2.21.0
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] net/ipv6: Fix misuse of proc_dointvec "skip_notify_on_dev_down"

From: Eiichi Tsukata <[email protected]>
Date: Tue, 25 Jun 2019 12:08:01 +0900

Quoted 5 lines

/proc/sys/net/ipv6/route/skip_notify_on_dev_down assumes given value to be 0 or 1. Use proc_dointvec_minmax instead of proc_dointvec.

Fixes 7c6bb7d2faaf ("net/ipv6: Add knob to skip DELROUTE message ondevice down")

Applied.

maintainer
#3 lore raw
In reply to Eiichi Tsukata
Quoted 14 lines · Eiichi Tsukata

/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)"
---
 drivers/tty/tty_ldisc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/tty_ldisc.c +0 -0
index e38f104db174..a8ea7a35c94e 100644

drivers/tty/tty_ldisc.c static struct ctl_table tty_table[] = { · line 868

Quoted 7 lines
drivers/tty/tty_ldisc.c +1 -1
@@ -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

#4 lore raw
Quoted 10 lines · Greg KH
Quoted 9 lines · Eiichi Tsukata

/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)"
---
 drivers/tty/tty_ldisc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

drivers/tty/tty_ldisc.c static struct ctl_table tty_table[] = { · line 868

Quoted 12 lines
drivers/tty/tty_ldisc.c +1 -1
index e38f104db174..a8ea7a35c94e 100644
@@ -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?

Someone may misuse -1 to disable ldisc autoload, but basically it does not "break".

Thanks,

Eiichi