]> git.itanic.dy.fi Git - linux-stable/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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jan 2022 14:24:59 +0000 (15:24 +0100)
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>
net/netrom/af_netrom.c

index 6d16e1ab1a8aba336f375ea0512e0ba86eff2876..eef0e3f2f25b0972debee403b424891094ef4dea 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) {