]> git.baikalelectronics.ru Git - kernel.git/commit
net: remove duplicate fetch in sock_getsockopt
authorJingYi Hou <houjingyi647@gmail.com>
Mon, 17 Jun 2019 06:56:05 +0000 (14:56 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 Jun 2019 17:04:16 +0000 (10:04 -0700)
commitfb005f656715d737613175479b3eb6f39d79846b
treeab344ba88e15da3f4a985f9ee4e662b0563fbfc3
parent53ea5153887498f4c0018afa5a2bdf77f0aa57a1
net: remove duplicate fetch in sock_getsockopt

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>
net/core/sock.c