* Re-add the range check for millisecond to jiffy conversion in sysctl
 
   They where removed in d174174c67 ("sysctl: replace SYSCTL_INT_CONV_CUSTOM
   macro with functions") and b96b5c6708 ("sysctl: Replace
   do_proc_do{int,ulong,uint}vec with do_proc_vec")
 
 * Fix type truncation in sysctl_msec_to_jiffies
 
   Previously truncated millisecond values now get converted into
   MAX_JIFFY_OFFSET
 
 * Testing
 
   Ran through x86_64 selftest. One week in linux-next
 -----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEErkcJVyXmMSXOyyeQupfNUreWQU8FAmqo8u8ACgkQupfNUreW
 QU8upgv+Khwwu6gXQNXyA91daXY+sxvpEdERi5qTyqYjQJ3zg+YFNWziZ7Yp+JVB
 wiYpmWKjqI1E1N/lC06vjQoKGkOnzHA0IMeCWFtO0wvIZFuWt200tGjS4fm1i48b
 /hF7aZK+oi8yrs1auzIOS+4d0VCDIfScWlAwIH1nqmt7xiUTlChLt9UNdbqusJVw
 NuMrX1CjxtPQqcZMdHwn83uiKkOvYN7DhPFI1VIgwWbp8TjTvskB0lsxqXMuxmUI
 xEt74FcWGhjhCjxy4i85P85LBcVT5W2l21GBvUqvzSP+aWK9/n/gCL2KWtJEASbb
 VaBEqN4azx/UEn4eUemGcBPsWG44a3i3hkx/V2UIJrbd/nh2EfQhugsrMtB0lAjL
 xSn48PlKMXeF7GgsUWC0NmHU0HwKrROEafWqayuFLHnobwfAb9KYFBkCV8phUS6E
 TfJPoDPwBzZebIP+HxY5SNY9CYTBnaUh/U8qq00eBgz/AUB6FwIXAuUMehnc9hcq
 mqFSZRt4
 =3g1Y
 -----END PGP SIGNATURE-----

Merge tag 'sysctl-7.03-fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl

Pull sysctl fixes from Joel Granados:

 - Re-add the range check for millisecond to jiffy conversion in sysctl

   They where removed in d174174c67 ("sysctl: replace
   SYSCTL_INT_CONV_CUSTOM macro with functions") and b96b5c6708
   ("sysctl: Replace do_proc_do{int,ulong,uint}vec with do_proc_vec")

 - Fix type truncation in sysctl_msec_to_jiffies

   Previously truncated millisecond values now get converted into
   MAX_JIFFY_OFFSET

* tag 'sysctl-7.03-fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl:
  sysctl: Fix type truncation in sysctl_msec_to_jiffies
  sysctl: Check range in do_proc_ulong_conv_ms_jiffies
  sysctl: Check range in  proc_dointvec_ms_jiffies_minmax
This commit is contained in:
Linus Torvalds 2026-09-15 09:43:15 -07:00
commit f6e7b42bf0

View File

@ -136,6 +136,8 @@ static int sysctl_k2u_int_conv_userhz(bool *negp, ulong *u_ptr, const int *k_ptr
static ulong sysctl_msecs_to_jiffies(const ulong val)
{
if (val > jiffies_to_msecs(MAX_JIFFY_OFFSET))
return MAX_JIFFY_OFFSET;
return msecs_to_jiffies(val);
}
@ -181,7 +183,7 @@ static int do_proc_int_conv_ms_jiffies_minmax(bool *negp, ulong *u_ptr,
int *k_ptr, int dir,
const struct ctl_table *tbl)
{
return proc_int_conv(negp, u_ptr, k_ptr, dir, tbl, false,
return proc_int_conv(negp, u_ptr, k_ptr, dir, tbl, true,
sysctl_u2k_int_conv_ms, sysctl_k2u_int_conv_ms);
}
@ -195,10 +197,10 @@ static int sysctl_k2u_ulong_conv_ms(ulong *u_ptr, const ulong *k_ptr)
return proc_ulong_k2u_conv_kop(u_ptr, k_ptr, sysctl_jiffies_to_msecs);
}
static int do_proc_ulong_conv_ms_jiffies(bool *negp, ulong *u_ptr, ulong *k_ptr,
int dir, const struct ctl_table *tbl)
static int do_proc_ulong_conv_ms_jiffies_minmax(bool *negp, ulong *u_ptr, ulong *k_ptr,
int dir, const struct ctl_table *tbl)
{
return proc_ulong_conv(u_ptr, k_ptr, dir, tbl, false,
return proc_ulong_conv(u_ptr, k_ptr, dir, tbl, true,
sysctl_u2k_ulong_conv_ms, sysctl_k2u_ulong_conv_ms);
}
@ -229,8 +231,8 @@ static int do_proc_int_conv_ms_jiffies_minmax(bool *negp, ulong *u_ptr,
return -ENOSYS;
}
static int do_proc_ulong_conv_ms_jiffies(bool *negp, ulong *u_ptr, ulong *k_ptr,
int dir, const struct ctl_table *tbl)
static int do_proc_ulong_conv_ms_jiffies_minmax(bool *negp, ulong *u_ptr, ulong *k_ptr,
int dir, const struct ctl_table *tbl)
{
return -ENOSYS;
}
@ -333,7 +335,7 @@ int proc_doulongvec_ms_jiffies_minmax(const struct ctl_table *table, int dir,
void *buffer, size_t *lenp, loff_t *ppos)
{
return proc_doulongvec_conv(table, dir, buffer, lenp, ppos,
do_proc_ulong_conv_ms_jiffies);
do_proc_ulong_conv_ms_jiffies_minmax);
}
EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);