summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-01-04 12:21:26 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-01-11 17:24:59 +0300
commita7c2cae997db6d39a858f42d898d866058a7e035 (patch)
treebcf8faced56c9cec8f64ed3a358c2a541ddc8906
parentbeeb0fdedae802a7fb606e955a81a56a2e3bbac1 (diff)
downloadlinux-a7c2cae997db6d39a858f42d898d866058a7e035.tar.xz
netrom: fix copying in user data in nr_setsockopt
commit 3087a6f36ee028ec095c04a8531d7d33899b7fed upstream. This code used to copy in an unsigned long worth of data before the sockptr_t conversion, so restore that. Fixes: a7b75c5a8c41 ("net: pass a sockptr_t into ->setsockopt") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/netrom/af_netrom.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 6d16e1ab1a8a..eef0e3f2f25b 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -306,7 +306,7 @@ static int nr_setsockopt(struct socket *sock, int level, int optname,
if (optlen < sizeof(unsigned int))
return -EINVAL;
- if (copy_from_sockptr(&opt, optval, sizeof(unsigned int)))
+ if (copy_from_sockptr(&opt, optval, sizeof(unsigned long)))
return -EFAULT;
switch (optname) {