Wang Yufen <wangyu...@huawei.com> writes:

> From: Yufen Wang <wangyu...@huawei.com>
>
> I tried on linux-4.1:
>     linux:~# cat /proc/sys/net/ipv4/tcp_mem 
>     8388608   12582912        16777216
>     linux:~# echo 1234 >/proc/sys/net/ipv4/tcp_mem 
>     -bash: echo: write error: Invalid argument
>     linux:~# cat /proc/sys/net/ipv4/tcp_mem 
>     1234      12582912        16777216
>
> the echo operation got error, but value already written to tcp_mem.
> If a write() returns an error like EINVAL, we expect no change occurred.
> This patch fix the confusing corner and makes __do_proc_doulongvec_minmax 
> works the same as __do_proc_dointvec

Nacked-by: "Eric W. Biederman" <ebied...@xmission.com>

Except for possibly breaking your muscle memory this does not explain
why this is a problem.

Further you are changing a whole lot more than tcp_mem, without a word
of justification in your description.

I do not think changing every integer use of sysctl for some unknown
reason.  Is justified in this case.

Eric



> Signed-off-by: Yufen Wang <wangyu...@huawei.com>
> Cc: Eric Dumazet <eric.duma...@gmail.com>
> Cc: "Eric W. Biederman" <ebied...@xmission.com>
> ---
>  kernel/sysctl.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index c3eee4c..e3ee4be 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -2318,6 +2318,8 @@ static int __do_proc_doulongvec_minmax(void *data, 
> struct ctl_table *table, int
>                       bool neg;
>  
>                       left -= proc_skip_spaces(&kbuf);
> +                        if (!left)
> +                                break;
>  
>                       err = proc_get_long(&kbuf, &left, &val, &neg,
>                                            proc_wspace_sep,
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to