Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1684429 > unrolled thread

[PATCH 4.9 16/41] sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2017-07-10 19:20 +0200
Last post2017-07-10 19:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.9 16/41] sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-10 19:20 +0200

#1684429 — [PATCH 4.9 16/41] sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-07-10 19:20 +0200
Subject[PATCH 4.9 16/41] sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec
Message-ID<u1KvL-7Qx-1@gated-at.bofh.it>
4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Liping Zhang <zlpnobody@gmail.com>

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>

---
 kernel/sysctl.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2146,6 +2146,8 @@ static int do_proc_douintvec_conv(bool *
 	if (write) {
 		if (*negp)
 			return -EINVAL;
+		if (*lvalp > UINT_MAX)
+			return -EINVAL;
 		*valp = *lvalp;
 	} else {
 		unsigned int val = *valp;

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web