Skip to content

Commit 1c38372

Browse files
committed
Merge branch 'work.sysctl' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull sysctl fixes from Al Viro: "Fixups to regressions in sysctl series" * 'work.sysctl' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: sysctl: reject gigantic reads/write to sysctl files cdrom: fix an incorrect __user annotation on cdrom_sysctl_info trace: fix an incorrect __user annotation on stack_trace_sysctl random: fix an incorrect __user annotation on proc_do_entropy net/sysctl: remove leftover __user annotations on neigh_proc_dointvec* net/sysctl: use cpumask_parse in flow_limit_cpu_sysctl
2 parents 3a8557e + ef9d965 commit 1c38372

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed

drivers/cdrom/cdrom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3535,7 +3535,7 @@ static int cdrom_print_info(const char *header, int val, char *info,
35353535
}
35363536

35373537
static int cdrom_sysctl_info(struct ctl_table *ctl, int write,
3538-
void __user *buffer, size_t *lenp, loff_t *ppos)
3538+
void *buffer, size_t *lenp, loff_t *ppos)
35393539
{
35403540
int pos;
35413541
char *info = cdrom_sysctl_settings.info;

drivers/char/random.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2087,7 +2087,7 @@ static int proc_do_uuid(struct ctl_table *table, int write,
20872087
* Return entropy available scaled to integral bits
20882088
*/
20892089
static int proc_do_entropy(struct ctl_table *table, int write,
2090-
void __user *buffer, size_t *lenp, loff_t *ppos)
2090+
void *buffer, size_t *lenp, loff_t *ppos)
20912091
{
20922092
struct ctl_table fake_table;
20932093
int entropy_count;

fs/proc/proc_sysctl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,10 @@ static ssize_t proc_sys_call_handler(struct file *filp, void __user *ubuf,
565565
if (!table->proc_handler)
566566
goto out;
567567

568+
/* don't even try if the size is too large */
569+
if (count > KMALLOC_MAX_SIZE)
570+
return -ENOMEM;
571+
568572
if (write) {
569573
kbuf = memdup_user_nul(ubuf, count);
570574
if (IS_ERR(kbuf)) {

include/linux/ftrace.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,8 @@ static inline void arch_ftrace_set_direct_caller(struct pt_regs *regs,
342342

343343
extern int stack_tracer_enabled;
344344

345-
int stack_trace_sysctl(struct ctl_table *table, int write,
346-
void __user *buffer, size_t *lenp,
347-
loff_t *ppos);
345+
int stack_trace_sysctl(struct ctl_table *table, int write, void *buffer,
346+
size_t *lenp, loff_t *ppos);
348347

349348
/* DO NOT MODIFY THIS VARIABLE DIRECTLY! */
350349
DECLARE_PER_CPU(int, disable_stack_tracer);

include/net/neighbour.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,12 @@ void *neigh_seq_next(struct seq_file *, void *, loff_t *);
392392
void neigh_seq_stop(struct seq_file *, void *);
393393

394394
int neigh_proc_dointvec(struct ctl_table *ctl, int write,
395-
void __user *buffer, size_t *lenp, loff_t *ppos);
395+
void *buffer, size_t *lenp, loff_t *ppos);
396396
int neigh_proc_dointvec_jiffies(struct ctl_table *ctl, int write,
397-
void __user *buffer,
397+
void *buffer,
398398
size_t *lenp, loff_t *ppos);
399399
int neigh_proc_dointvec_ms_jiffies(struct ctl_table *ctl, int write,
400-
void __user *buffer,
401-
size_t *lenp, loff_t *ppos);
400+
void *buffer, size_t *lenp, loff_t *ppos);
402401

403402
int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
404403
proc_handler *proc_handler);

kernel/trace/trace_stack.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,8 @@ static const struct file_operations stack_trace_filter_fops = {
515515
#endif /* CONFIG_DYNAMIC_FTRACE */
516516

517517
int
518-
stack_trace_sysctl(struct ctl_table *table, int write,
519-
void __user *buffer, size_t *lenp,
520-
loff_t *ppos)
518+
stack_trace_sysctl(struct ctl_table *table, int write, void *buffer,
519+
size_t *lenp, loff_t *ppos)
521520
{
522521
int was_enabled;
523522
int ret;

net/core/sysctl_net_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static int flow_limit_cpu_sysctl(struct ctl_table *table, int write,
128128
return -ENOMEM;
129129

130130
if (write) {
131-
ret = cpumask_parse_user(buffer, *lenp, mask);
131+
ret = cpumask_parse(buffer, mask);
132132
if (ret)
133133
goto done;
134134

0 commit comments

Comments
 (0)