提交 9323b943 编写于 作者: A Artur Molchanov 提交者: Yang Yingliang

net/sunrpc: Fix return value for sysctl sunrpc.transports

mainline inclusion
from mainline-5.10-rc1
commit c09f56b8
category: bugfix
bugzilla: 51817
CVE: NA

-------------------------------------------------
Fix returning value for sysctl sunrpc.transports.
Return error code from sysctl proc_handler function proc_do_xprt instead of number of the written bytes.
Otherwise sysctl returns random garbage for this key.

Since v1:
- Handle negative returned value from memory_read_from_buffer as an error
Signed-off-by: NArtur Molchanov <arturmolchanov@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
(cherry picked from commit c09f56b8)
Signed-off-by: NBaisong Zhong <zhongbaisong@huawei.com>
Reviewed-by: NYue Haibing <yuehaibing@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 49f46108
......@@ -69,7 +69,13 @@ static int proc_do_xprt(struct ctl_table *table, int write,
return 0;
}
len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
return simple_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
*lenp = simple_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
if (*lenp < 0) {
*lenp = 0;
return -EINVAL;
}
return 0;
}
static int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册