]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sysctl.c: fix underflow value setting risk in vm_table
authorLin Feng <linf@wangsu.com>
Thu, 31 Dec 2020 22:04:41 +0000 (22:04 +0000)
committerJohannes Weiner <hannes@cmpxchg.org>
Thu, 31 Dec 2020 22:04:41 +0000 (22:04 +0000)
commit6a8b645fc104a97a96d02a276a22c1353ee38709
treea4500a40630a6d21850c38249b1382bff675c372
parent5d8d191b2d28b25aa1f85f200c59448ca4b5de91
sysctl.c: fix underflow value setting risk in vm_table

Apart from subsystem specific .proc_handler handler, all ctl_tables with
extra1 and extra2 members set should use proc_dointvec_minmax instead of
proc_dointvec, or the limit set in extra* never work and potentially echo
underflow values(negative numbers) is likely make system unstable.

Especially vfs_cache_pressure and zone_reclaim_mode, -1 is apparently not
a valid value, but we can set to them.  And then kernel may crash.

# echo -1 > /proc/sys/vm/vfs_cache_pressure

Link: https://lkml.kernel.org/r/20201223105535.2875-1-linf@wangsu.com
Signed-off-by: Lin Feng <linf@wangsu.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/sysctl.c