mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 22:19:30 +02:00
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 ind174174c67("sysctl: replace SYSCTL_INT_CONV_CUSTOM macro with functions") andb96b5c6708("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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user