diff options
author | Xiaobo Liu <cppcoffee@gmail.com> | 2022-10-14 05:05:40 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-10-30 11:41:16 +0300 |
commit | 118f412bedc5843032d65f41eb4e635a830c2fa8 (patch) | |
tree | 2a32aba359b9da5f8104440435e5b31a840bcd24 /net | |
parent | c8310a99e7e4ad658aa5160fe817533d0d7069fe (diff) | |
download | linux-118f412bedc5843032d65f41eb4e635a830c2fa8.tar.xz |
net/atm: fix proc_mpc_write incorrect return value
[ Upstream commit d8bde3bf7f82dac5fc68a62c2816793a12cafa2a ]
Then the input contains '\0' or '\n', proc_mpc_write has read them,
so the return value needs +1.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/atm/mpoa_proc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c index 829db9eba0cb..aaf64b953915 100644 --- a/net/atm/mpoa_proc.c +++ b/net/atm/mpoa_proc.c @@ -219,11 +219,12 @@ static ssize_t proc_mpc_write(struct file *file, const char __user *buff, if (!page) return -ENOMEM; - for (p = page, len = 0; len < nbytes; p++, len++) { + for (p = page, len = 0; len < nbytes; p++) { if (get_user(*p, buff++)) { free_page((unsigned long)page); return -EFAULT; } + len += 1; if (*p == '\0' || *p == '\n') break; } |