Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933146AbbHYUkR (ORCPT ); Tue, 25 Aug 2015 16:40:17 -0400 Received: from mout.gmx.net ([212.227.17.21]:54364 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933019AbbHYUkO (ORCPT ); Tue, 25 Aug 2015 16:40:14 -0400 Message-ID: <55DCD29D.902@gmx.de> Date: Tue, 25 Aug 2015 22:39:57 +0200 From: Heinrich Schuchardt User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: Sean Fu , 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 , David Rientjes , linux-kernel@vger.kernel.org Subject: Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success. References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:UZvgdgJ36kv+EMjUKpxbSX6FdiRIs2sOnboqLYPJOPLY5benN+U eQFkFyTDRAwGFDTIgPct2QR5FITZPz9+p7NVYaL/W4vFRWzVzG+NxBxodE7hwUr8Yt07Rmn pFw/LbDVoAAz0KQXwWNltKL9dSVlOC03RoVVcw/Hhf8d35FQ59cGgwuy2RFXMntAHZVZDW+ pDcWnaR38BMXvEof4txqA== X-UI-Out-Filterresults: notjunk:1;V01:K0:Vd83kV+o8og=:YMaBvC8OUohJ5t18IaK59X HBuJJSzurv81W9IudcV6N/s0HkmBeSNXiI8Wu7pwY299zboAP3M8xVSMk5CO6C3J2a4Ocdx4a LOytrgu1xgUEZ2JNLRkXIBu5gKs0mKk9UHF+uHcl5X3k4QAFKHBtmRGZnTb1Nfj/va+owW15c 1JnnrIoTvl2YyWkiInYbjG0eHGxW1FpQCY+vmSUs3YPiboblNy5VOobL4ahnoUT1zXf+Su8I1 WBEe2g8DW0LSRMm5I543UZIkWjr+11bnGajoT03Ftc7kObfwV6vEjIKF5f6Io92oCXOA+Ab1q ywPtr+BCOYSKdARbRuJCYyR1FXufcqwdjMuQ3ndGojFxggigiGQDnXXCZLyAnf4nAls2E0DiG mh1Xh3iOFlhC4+3TOV4clFf9COZ+k7QGJAIPlh0dsuWymrnevJ0KUw5R9+U5IQb1YVYyF7Am/ lNtZjr28Xuyc9Tp3L8UQ/MQpuiz1Yv/KzJaU3JAkj8whBbz9b2PhTQGPyb+D+GpubPzdSXt7C roF/mMPQpM8Fvkbttc6J1VfMEkz0cDllM3arh7+NP2YC5PU2jXR6Q7WvkOhnMf+q8AVezORkd zyeLEflp8ans1TxGfhjHtZAZcNMBQ+Ps80tPCAwYBrqMfRSp8bRKw8oFyLR8g6tEYB5YxiV2U lizvGOjbAm9wkO9wRHD51wGszEPpB7WFHB5WjjqpZkRei8kCVrAOOvZg2ql7n3ZqFHPQ7VEJ8 Ff8+EKqAbr1tFt/K4gKsvLKWsBfeCPgFh3FyTA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1531 Lines: 48 On 24.08.2015 10:56, Sean Fu wrote: > 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. Reading through kernel/sysctl.c it looks like you are allowing "1\01" to be used to pass two integers or two longs. This is not what you describe as target of your patch. Parameter tr returned from proc_get_long should be checked in __do_proc_dointvec, __do_proc_doulongvec_minmax. Best regards Heinrich Schuchardt > > Signed-off-by: Sean Fu > --- > 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, > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/