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


Groups > linux.kernel > #1618924

[PATCH 2/3] sysctl: don't print negative flag for proc_douintvec

From Liping Zhang <zlpnobody@163.com>
Newsgroups linux.kernel
Subject [PATCH 2/3] sysctl: don't print negative flag for proc_douintvec
Date 2017-04-07 18:00 +0200
Message-ID <ttEsO-K9-15@gated-at.bofh.it> (permalink)
References <ttEsN-K9-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Liping Zhang <zlpnobody@gmail.com>

I saw some very confusing sysctl output on my system:
  # cat /proc/sys/net/core/xfrm_aevent_rseqth
  -2
  # cat /proc/sys/net/core/xfrm_aevent_etime
  -10
  cat /proc/sys/net/ipv4/tcp_notsent_lowat
  -4294967295

Because we forget to set the *negp flag in proc_douintvec, so it will
become a garbage value.

Since the value related to proc_douintvec is always an unsigned integer,
so we can set *negp to false explictily to fix this issue.

Fixes: e7d316a02f68 ("sysctl: handle error writing UINT_MAX to u32 fields")
Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
---
 kernel/sysctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index acf0a5a..8cca4c7 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2136,6 +2136,7 @@ static int do_proc_douintvec_conv(bool *negp, unsigned long *lvalp,
 		*valp = *lvalp;
 	} else {
 		unsigned int val = *valp;
+		*negp = false;
 		*lvalp = (unsigned long)val;
 	}
 	return 0;
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] sysctl: fix some bugs related to proc_douintvec Liping Zhang <zlpnobody@163.com> - 2017-04-07 18:00 +0200
  [PATCH 2/3] sysctl: don't print negative flag for proc_douintvec Liping Zhang <zlpnobody@163.com> - 2017-04-07 18:00 +0200
  [PATCH 1/3] sysctl: add sanity check for proc_douintvec Liping Zhang <zlpnobody@163.com> - 2017-04-07 18:00 +0200

csiph-web