]> Git Repo - J-linux.git/commitdiff
Merge tag 'sysctl-fixes-5.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <[email protected]>
Fri, 15 Jul 2022 16:52:35 +0000 (09:52 -0700)
committerLinus Torvalds <[email protected]>
Fri, 15 Jul 2022 16:52:35 +0000 (09:52 -0700)
Pyll sysctl fix from Luis Chamberlain:
 "Only one fix for sysctl"

* tag 'sysctl-fixes-5.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux:
  mm: sysctl: fix missing numa_stat when !CONFIG_HUGETLB_PAGE

1  2 
kernel/sysctl.c

diff --combined kernel/sysctl.c
index d99bc39454454812d860376feaaf5e22c274d8ef,aaf0b1f1dc573f7d427e8fc89a84facc27afab5c..35d0342195132e3873c32b3063b72f921daa377e
@@@ -446,14 -446,14 +446,14 @@@ static int do_proc_dointvec_conv(bool *
                if (*negp) {
                        if (*lvalp > (unsigned long) INT_MAX + 1)
                                return -EINVAL;
 -                      *valp = -*lvalp;
 +                      WRITE_ONCE(*valp, -*lvalp);
                } else {
                        if (*lvalp > (unsigned long) INT_MAX)
                                return -EINVAL;
 -                      *valp = *lvalp;
 +                      WRITE_ONCE(*valp, *lvalp);
                }
        } else {
 -              int val = *valp;
 +              int val = READ_ONCE(*valp);
                if (val < 0) {
                        *negp = true;
                        *lvalp = -(unsigned long)val;
@@@ -472,9 -472,9 +472,9 @@@ static int do_proc_douintvec_conv(unsig
        if (write) {
                if (*lvalp > UINT_MAX)
                        return -EINVAL;
 -              *valp = *lvalp;
 +              WRITE_ONCE(*valp, *lvalp);
        } else {
 -              unsigned int val = *valp;
 +              unsigned int val = READ_ONCE(*valp);
                *lvalp = (unsigned long)val;
        }
        return 0;
@@@ -857,7 -857,7 +857,7 @@@ static int do_proc_dointvec_minmax_conv
                if ((param->min && *param->min > tmp) ||
                    (param->max && *param->max < tmp))
                        return -EINVAL;
 -              *valp = tmp;
 +              WRITE_ONCE(*valp, tmp);
        }
  
        return 0;
@@@ -923,7 -923,7 +923,7 @@@ static int do_proc_douintvec_minmax_con
                    (param->max && *param->max < tmp))
                        return -ERANGE;
  
 -              *valp = tmp;
 +              WRITE_ONCE(*valp, tmp);
        }
  
        return 0;
@@@ -1007,13 -1007,13 +1007,13 @@@ int proc_dou8vec_minmax(struct ctl_tabl
  
        tmp.maxlen = sizeof(val);
        tmp.data = &val;
 -      val = *data;
 +      val = READ_ONCE(*data);
        res = do_proc_douintvec(&tmp, write, buffer, lenp, ppos,
                                do_proc_douintvec_minmax_conv, &param);
        if (res)
                return res;
        if (write)
 -              *data = val;
 +              WRITE_ONCE(*data, val);
        return 0;
  }
  EXPORT_SYMBOL_GPL(proc_dou8vec_minmax);
@@@ -1090,9 -1090,9 +1090,9 @@@ static int __do_proc_doulongvec_minmax(
                                err = -EINVAL;
                                break;
                        }
 -                      *i = val;
 +                      WRITE_ONCE(*i, val);
                } else {
 -                      val = convdiv * (*i) / convmul;
 +                      val = convdiv * READ_ONCE(*i) / convmul;
                        if (!first)
                                proc_put_char(&buffer, &left, '\t');
                        proc_put_long(&buffer, &left, val, false);
@@@ -1173,12 -1173,9 +1173,12 @@@ static int do_proc_dointvec_jiffies_con
        if (write) {
                if (*lvalp > INT_MAX / HZ)
                        return 1;
 -              *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
 +              if (*negp)
 +                      WRITE_ONCE(*valp, -*lvalp * HZ);
 +              else
 +                      WRITE_ONCE(*valp, *lvalp * HZ);
        } else {
 -              int val = *valp;
 +              int val = READ_ONCE(*valp);
                unsigned long lval;
                if (val < 0) {
                        *negp = true;
@@@ -1224,9 -1221,9 +1224,9 @@@ static int do_proc_dointvec_ms_jiffies_
  
                if (jif > INT_MAX)
                        return 1;
 -              *valp = (int)jif;
 +              WRITE_ONCE(*valp, (int)jif);
        } else {
 -              int val = *valp;
 +              int val = READ_ONCE(*valp);
                unsigned long lval;
                if (val < 0) {
                        *negp = true;
@@@ -1294,8 -1291,8 +1294,8 @@@ int proc_dointvec_userhz_jiffies(struc
   * @ppos: the current position in the file
   *
   * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
 - * values from/to the user buffer, treated as an ASCII string. 
 - * The values read are assumed to be in 1/1000 seconds, and 
 + * values from/to the user buffer, treated as an ASCII string.
 + * The values read are assumed to be in 1/1000 seconds, and
   * are converted into jiffies.
   *
   * Returns 0 on success.
@@@ -2094,6 -2091,17 +2094,17 @@@ static struct ctl_table vm_table[] = 
                .extra1         = SYSCTL_ZERO,
                .extra2         = SYSCTL_TWO_HUNDRED,
        },
+ #ifdef CONFIG_NUMA
+       {
+               .procname       = "numa_stat",
+               .data           = &sysctl_vm_numa_stat,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = sysctl_vm_numa_stat_handler,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = SYSCTL_ONE,
+       },
+ #endif
  #ifdef CONFIG_HUGETLB_PAGE
        {
                .procname       = "nr_hugepages",
                .mode           = 0644,
                .proc_handler   = &hugetlb_mempolicy_sysctl_handler,
        },
-       {
-               .procname               = "numa_stat",
-               .data                   = &sysctl_vm_numa_stat,
-               .maxlen                 = sizeof(int),
-               .mode                   = 0644,
-               .proc_handler   = sysctl_vm_numa_stat_handler,
-               .extra1                 = SYSCTL_ZERO,
-               .extra2                 = SYSCTL_ONE,
-       },
  #endif
         {
                .procname       = "hugetlb_shm_group",
This page took 0.061571 seconds and 4 git commands to generate.