提交 970177a0 编写于 作者: C Christoph Hellwig 提交者: Zheng Zengkai

netrom: fix copying in user data in nr_setsockopt

stable inclusion
from stable-v5.10.91
commit a7c2cae997db6d39a858f42d898d866058a7e035
bugzilla: 186187 https://gitee.com/openeuler/kernel/issues/I4SI2C

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a7c2cae997db6d39a858f42d898d866058a7e035

--------------------------------

commit 3087a6f3 upstream.

This code used to copy in an unsigned long worth of data before
the sockptr_t conversion, so restore that.

Fixes: a7b75c5a ("net: pass a sockptr_t into ->setsockopt")
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 0f64c893
...@@ -306,7 +306,7 @@ static int nr_setsockopt(struct socket *sock, int level, int optname, ...@@ -306,7 +306,7 @@ static int nr_setsockopt(struct socket *sock, int level, int optname,
if (optlen < sizeof(unsigned int)) if (optlen < sizeof(unsigned int))
return -EINVAL; return -EINVAL;
if (copy_from_sockptr(&opt, optval, sizeof(unsigned int))) if (copy_from_sockptr(&opt, optval, sizeof(unsigned long)))
return -EFAULT; return -EFAULT;
switch (optname) { switch (optname) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册