Skip to content

Commit

Permalink
netrom: fix copying in user data in nr_setsockopt
Browse files Browse the repository at this point in the history
This code used to copy in an unsigned long worth of data before
the sockptr_t conversion, so restore that.

Fixes: a7b75c5 ("net: pass a sockptr_t into ->setsockopt")
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Christoph Hellwig authored and davem330 committed Jan 4, 2022
1 parent d2d9a6d commit 3087a6f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netrom/af_netrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3087a6f

Please sign in to comment.