net:rfs: adjust table size checking
[firefly-linux-kernel-4.4.55.git] / net / core / sysctl_net_core.c
index 31baba2a71ce15e49450f69dae81e7d3be1ff3f2..eaa51ddf2368747c21399bf44f5a1993c0a0e39b 100644 (file)
@@ -52,7 +52,7 @@ static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
 
        if (write) {
                if (size) {
-                       if (size > 1<<30) {
+                       if (size > 1<<29) {
                                /* Enforce limit to prevent overflow */
                                mutex_unlock(&sock_flow_mutex);
                                return -EINVAL;
@@ -65,7 +65,7 @@ static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
                                        mutex_unlock(&sock_flow_mutex);
                                        return -ENOMEM;
                                }
-
+                               rps_cpu_mask = roundup_pow_of_two(nr_cpu_ids) - 1;
                                sock_table->mask = size - 1;
                        } else
                                sock_table = orig_sock_table;
@@ -321,6 +321,15 @@ static struct ctl_table net_core_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec
        },
+       {
+               .procname       = "tstamp_allow_data",
+               .data           = &sysctl_tstamp_allow_data,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = &zero,
+               .extra2         = &one
+       },
 #ifdef CONFIG_RPS
        {
                .procname       = "rps_sock_flow_entries",