The patch titled Subject: fs/proc/proc_sysctl.c: check for invalid flags bits has been added to the -mm tree. Its filename is proc-sysctl-check-for-invalid-flags-bits.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/proc-sysctl-check-for-invalid-flags-bits.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/proc-sysctl-check-for-invalid-flags-bits.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Waiman Long <longman@xxxxxxxxxx> Subject: fs/proc/proc_sysctl.c: check for invalid flags bits Checking code is added to check for invalid flags in the ctl_table and return error if an unknown flag is used. Link: http://lkml.kernel.org/r/1520885744-1546-3-git-send-email-longman@xxxxxxxxxx Signed-off-by: Waiman Long <longman@xxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Davidlohr Bueso <dave@xxxxxxxxxxxx> Cc: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: "Luis R. Rodriguez" <mcgrof@xxxxxxxxxx> Cc: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/proc/proc_sysctl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff -puN fs/proc/proc_sysctl.c~proc-sysctl-check-for-invalid-flags-bits fs/proc/proc_sysctl.c --- a/fs/proc/proc_sysctl.c~proc-sysctl-check-for-invalid-flags-bits +++ a/fs/proc/proc_sysctl.c @@ -1092,6 +1092,16 @@ static int sysctl_check_table_array(cons return err; } +static int sysctl_check_flags(const char *path, struct ctl_table *table) +{ + int err = 0; + + if (table->flags & ~CTL_TABLE_FLAGS_ALL) + err = sysctl_err(path, table, "invalid flags"); + + return err; +} + static int sysctl_check_table(const char *path, struct ctl_table *table) { int err = 0; @@ -1111,6 +1121,8 @@ static int sysctl_check_table(const char (table->proc_handler == proc_doulongvec_ms_jiffies_minmax)) { if (!table->data) err |= sysctl_err(path, table, "No data"); + if (table->flags) + err |= sysctl_check_flags(path, table); if (!table->maxlen) err |= sysctl_err(path, table, "No maxlen"); else _ Patches currently in -mm which might be from longman@xxxxxxxxxx are list_lru-prefetch-neighboring-list-entries-before-acquiring-lock.patch proc-sysctl-fix-typo-in-sysctl_check_table_array.patch sysctl-add-kdoc-comments-to-do_proc_douintvec_minmax_conv_param.patch sysctl-add-flags-to-support-min-max-range-clamping.patch proc-sysctl-check-for-invalid-flags-bits.patch sysctl-warn-when-a-clamped-sysctl-parameter-is-set-out-of-range.patch ipc-clamp-msgmni-and-shmmni-to-the-real-ipcmni-limit.patch ipc-clamp-semmni-to-the-real-ipcmni-limit.patch test_sysctl-add-range-clamping-test.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html