public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.
@ 2015-08-24  8:56 Sean Fu
  2015-08-24 12:27 ` Eric W. Biederman
                   ` (2 more replies)
  0 siblings, 3 replies; 37+ messages in thread
From: Sean Fu @ 2015-08-24  8:56 UTC (permalink / raw)
  To: Andrey Ryabinin, Ulrich Obergfell, Steven Rostedt (Red Hat),
	Prarit Bhargava, Eric B Munson, Paul E. McKenney, Johannes Weiner,
	Eric W. Biederman
  Cc: Andrew Morton, Thomas Gleixner, Don Zickus, Heinrich Schuchardt,
	David Rientjes, linux-kernel

when the input argument "count" including the terminating byte "\0",
The write system call return EINVAL on proc file.
But it return success on regular file.

E.g. Writting two bytes ("1\0") to "/proc/sys/net/ipv4/conf/eth0/rp_filter".
write(fd, "1\0", 2) return EINVAL.

Signed-off-by: Sean Fu <fxinrong@gmail.com>
---
 kernel/sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 19b62b5..c2b0594 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2004,7 +2004,7 @@ static int do_proc_dointvec_conv(bool *negp,
unsigned long *lvalp,
        return 0;
 }

-static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
+static const char proc_wspace_sep[] = { ' ', '\t', '\n', '\0' };

 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
                  int write, void __user *buffer,
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2015-09-15 14:11 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-24  8:56 [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success Sean Fu
2015-08-24 12:27 ` Eric W. Biederman
2015-08-24 15:33   ` Sean Fu
2015-08-24 20:44     ` Andrew Morton
2015-08-24 21:24       ` Heinrich Schuchardt
2015-08-24 16:59 ` Steven Rostedt
2015-08-25  0:57   ` Sean Fu
2015-08-25  2:24     ` Eric W. Biederman
2015-08-25  7:50       ` Sean Fu
2015-08-25 14:15         ` Steven Rostedt
2015-08-25 16:44           ` Sean Fu
2015-08-25 17:33             ` Austin S Hemmelgarn
2015-08-25 19:05               ` Steven Rostedt
2015-08-26 15:48                 ` Sean Fu
2015-08-26 20:36                   ` Steven Rostedt
2015-08-27  0:17                     ` Sean Fu
2015-08-27  2:32                       ` Steven Rostedt
2015-08-27  8:32                         ` Sean Fu
2015-08-28  3:31                           ` Sean Fu
2015-09-08  3:11                             ` Sean Fu
2015-09-08 15:17                               ` Steven Rostedt
2015-09-08 16:19                                 ` Eric W. Biederman
2015-09-08 16:36                                   ` Steven Rostedt
2015-09-11  9:05                                     ` Sean Fu
2015-09-11 13:49                                       ` Steven Rostedt
2015-09-11 17:01                                       ` Eric W. Biederman
2015-09-13 12:39                                         ` Sean Fu
2015-09-13 16:44                                           ` Eric W. Biederman
2015-09-15  9:30                                             ` Sean Fu
2015-09-15 14:11                                               ` Eric W. Biederman
2015-09-13 20:05                                           ` Steven Rostedt
2015-09-15  9:10                                             ` Sean Fu
2015-09-15 13:51                                               ` Steven Rostedt
2015-08-25  3:12     ` Sean Fu
2015-08-25 20:39 ` Heinrich Schuchardt
2015-08-26  9:30   ` Sean Fu
2015-08-27  0:32   ` Sean Fu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox