]> git.baikalelectronics.ru Git - kernel.git/commitdiff
netrom: fix copying in user data in nr_setsockopt
authorChristoph Hellwig <hch@lst.de>
Tue, 4 Jan 2022 09:21:26 +0000 (10:21 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Jan 2022 12:36:01 +0000 (12:36 +0000)
This code used to copy in an unsigned long worth of data before
the sockptr_t conversion, so restore that.

Fixes: cf0058199c0b ("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>
net/netrom/af_netrom.c

index 775064cdd0ee4d0b263a83c38dfd06cac53a91b2..f1ba7dd3d253d3979f436500b090c42cb512a870 100644 (file)
@@ -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) {