diff options
author | JingYi Hou <houjingyi647@gmail.com> | 2019-06-17 09:56:05 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-03 14:13:41 +0300 |
commit | 505c925823144996daa030e4bbe26660569a0609 (patch) | |
tree | 012c0db3327cf568ea88f8b902692baaca967967 | |
parent | 65b2a8047939229a9e767b82d741bee4f8ac6b53 (diff) | |
download | linux-505c925823144996daa030e4bbe26660569a0609.tar.xz |
net: remove duplicate fetch in sock_getsockopt
[ Upstream commit d0bae4a0e3d8c5690a885204d7eb2341a5b4884d ]
In sock_getsockopt(), 'optlen' is fetched the first time from userspace.
'len < 0' is then checked. Then in condition 'SO_MEMINFO', 'optlen' is
fetched the second time from userspace.
If change it between two fetches may cause security problems or unexpected
behaivor, and there is no reason to fetch it a second time.
To fix this, we need to remove the second fetch.
Signed-off-by: JingYi Hou <houjingyi647@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/core/sock.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 067878a1e4c5..30afb072eecf 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1482,9 +1482,6 @@ int sock_getsockopt(struct socket *sock, int level, int optname, { u32 meminfo[SK_MEMINFO_VARS]; - if (get_user(len, optlen)) - return -EFAULT; - sk_get_meminfo(sk, meminfo); len = min_t(unsigned int, len, sizeof(meminfo)); |