Skip to content

Commit a214822

Browse files
Liping Zhanggregkh
authored andcommitted
sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec
commit 425fffd886bae3d127a08fa6a17f2e31e24ed7ff upstream. Currently, inputting the following command will succeed but actually the value will be truncated: # echo 0x12ffffffff > /proc/sys/net/ipv4/tcp_notsent_lowat This is not friendly to the user, so instead, we should report error when the value is larger than UINT_MAX. Fixes: e7d316a02f68 ("sysctl: handle error writing UINT_MAX to u32 fields") Signed-off-by: Liping Zhang <zlpnobody@gmail.com> Cc: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e8505e6 commit a214822

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

kernel/sysctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,6 +2067,8 @@ static int do_proc_douintvec_conv(bool *negp, unsigned long *lvalp,
20672067
if (write) {
20682068
if (*negp)
20692069
return -EINVAL;
2070+
if (*lvalp > UINT_MAX)
2071+
return -EINVAL;
20702072
*valp = *lvalp;
20712073
} else {
20722074
unsigned int val = *valp;

0 commit comments

Comments
 (0)