From ea60e2fbe4a8361877e3b381b2728a9dbd981f65 Mon Sep 17 00:00:00 2001 From: Subash Abhinov Kasiviswanathan Date: Tue, 14 Jun 2016 14:58:43 -0600 Subject: [PATCH] Revert "kernel/sysctl.c: detect overflows when converting to int" We have scripts which write to certain fields on 3.18 kernels but this seems to be failing on 4.4 kernels. An entry which we write to here is xfrm_aevent_rseqth which is u32. echo 4294967295 > /proc/sys/net/core/xfrm_aevent_rseqth Commit 230633d109e35b0a24277498e773edeb79b4a331 ("kernel/sysctl.c: detect overflows when converting to int") prevented writing to sysctl entries when integer overflow occurs. However, this does not apply to unsigned integers. u32 should be able to hold 4294967295 here, however it fails due to this check. static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp, if (*lvalp > (unsigned long) INT_MAX) return -EINVAL; Fix this for now by reverting this commit till a solution is finalized upstream. CRs-Fixed: 1026507 Change-Id: I4fae5f442e4cc2c2414a69e960d42c05c3062415 Signed-off-by: Subash Abhinov Kasiviswanathan --- kernel/sysctl.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 6a7751e99e82..81fbed978da3 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2244,15 +2244,7 @@ static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp, int write, void *data) { if (write) { - if (*negp) { - if (*lvalp > (unsigned long) INT_MAX + 1) - return -EINVAL; - *valp = -*lvalp; - } else { - if (*lvalp > (unsigned long) INT_MAX) - return -EINVAL; - *valp = *lvalp; - } + *valp = *negp ? -*lvalp : *lvalp; } else { int val = *valp; if (val < 0) {