tipc: set sysctl_tipc_rmem and named_timeout right range [Linux 3.16.72]

This Linux kernel change "tipc: set sysctl_tipc_rmem and named_timeout right range" is included in the Linux 3.16.72 release. This change is authored by Jie Liu <liujie165 [at] huawei.com> on Tue Apr 16 13:10:09 2019 +0800. The commit for this change in Linux stable tree is f96f164 (patch) which is from upstream commit 4bcd4ec. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 4bcd4ec.

tipc: set sysctl_tipc_rmem and named_timeout right range

commit 4bcd4ec1017205644a2697bccbc3b5143f522f5f upstream.

We find that sysctl_tipc_rmem and named_timeout do not have the right minimum
setting. sysctl_tipc_rmem should be larger than zero, like sysctl_tcp_rmem.
And named_timeout as a timeout setting should be not less than zero.

Fixes: cc79dd1ba9c10 ("tipc: change socket buffer overflow control to respect sk_rcvbuf")
Fixes: a5325ae5b8bff ("tipc: add name distributor resiliency queue")
Signed-off-by: Jie Liu <[email protected]>
Reported-by: Qiang Ning <[email protected]>
Reviewed-by: Zhiqiang Liu <l[email protected]>
Reviewed-by: Miaohe Lin <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
[bwh: Backported to 3.16: only the tipc_rmem sysctl exists here]
Signed-off-by: Ben Hutchings <[email protected]>

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/tipc/sysctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/tipc/sysctl.c b/net/tipc/sysctl.c
index f3fef93..a4125b0 100644
--- a/net/tipc/sysctl.c
+++ b/net/tipc/sysctl.c
@@ -37,6 +37,7 @@

 #include <linux/sysctl.h>

+static int one = 1;
 static struct ctl_table_header *tipc_ctl_hdr;

 static struct ctl_table tipc_table[] = {
@@ -45,7 +46,8 @@
        .data       = &sysctl_tipc_rmem,
        .maxlen     = sizeof(sysctl_tipc_rmem),
        .mode       = 0644,
-       .proc_handler   = proc_dointvec,
+       .proc_handler   = proc_dointvec_minmax,
+       .extra1         = &one,

Leave a Reply

Your email address will not be published. Required fields are marked *