[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220104092126.172508-1-hch@lst.de>
Date: Tue, 4 Jan 2022 10:21:26 +0100
From: Christoph Hellwig <hch@....de>
To: ralf@...ux-mips.org, davem@...emloft.net, kuba@...nel.org
Cc: linux-hams@...r.kernel.org, netdev@...r.kernel.org,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: [PATCH] netrom: fix copying in user data in nr_setsockopt
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@...cle.com>
Signed-off-by: Christoph Hellwig <hch@....de>
---
net/netrom/af_netrom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 775064cdd0ee4..f1ba7dd3d253d 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) {
--
2.30.2
Powered by blists - more mailing lists