Skip to content

Commit 425fffd

Browse files
Liping Zhangtorvalds
authored andcommitted
sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec
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: e7d316a ("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>
1 parent 8b65bb5 commit 425fffd

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
@@ -2133,6 +2133,8 @@ static int do_proc_douintvec_conv(bool *negp, unsigned long *lvalp,
21332133
if (write) {
21342134
if (*negp)
21352135
return -EINVAL;
2136+
if (*lvalp > UINT_MAX)
2137+
return -EINVAL;
21362138
*valp = *lvalp;
21372139
} else {
21382140
unsigned int val = *valp;

0 commit comments

Comments
 (0)