Commit 563b04671017ea00ba563ebeebdc36bce79b1b60
Committed by
David S. Miller
1 parent
dd7496f217
Exists in
master
and in
4 other branches
proc_dointvec: write a single value
The commit 00b7c3395aec3df43de5bd02a3c5a099ca51169f "sysctl: refactor integer handling proc code" modified the behaviour of writing to /proc. Before the commit, write("1\n") to /proc/sys/kernel/printk succeeded. But now it returns EINVAL. This commit supports writing a single value to a multi-valued entry. Signed-off-by: J. R. Okajima <hooanon05@yahoo.co.jp> Reviewed-and-tested-by: WANG Cong <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff
kernel/sysctl.c
... | ... | @@ -2253,6 +2253,8 @@ |
2253 | 2253 | if (write) { |
2254 | 2254 | left -= proc_skip_spaces(&kbuf); |
2255 | 2255 | |
2256 | + if (!left) | |
2257 | + break; | |
2256 | 2258 | err = proc_get_long(&kbuf, &left, &lval, &neg, |
2257 | 2259 | proc_wspace_sep, |
2258 | 2260 | sizeof(proc_wspace_sep), NULL); |
... | ... | @@ -2279,7 +2281,7 @@ |
2279 | 2281 | |
2280 | 2282 | if (!write && !first && left && !err) |
2281 | 2283 | err = proc_put_char(&buffer, &left, '\n'); |
2282 | - if (write && !err) | |
2284 | + if (write && !err && left) | |
2283 | 2285 | left -= proc_skip_spaces(&kbuf); |
2284 | 2286 | free: |
2285 | 2287 | if (write) { |