summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorUrsula Braun <ursula.braun@linux.ibm.com>2018-07-18 15:22:50 +0200
committerDavid S. Miller <davem@davemloft.net>2018-07-18 10:58:27 -0700
commitac0107edba253a6e58e923f9e68825decef3e681 (patch)
treefb2c0ad4a31a876a05095a431b11375736d0b75d /net
parent99be51f11d51400f744632f3938445a8d4de8943 (diff)
downloadlinux-ac0107edba253a6e58e923f9e68825decef3e681.tar.gz
linux-ac0107edba253a6e58e923f9e68825decef3e681.tar.bz2
linux-ac0107edba253a6e58e923f9e68825decef3e681.zip
net/smc: add error handling for get_user()
For security reasons the return code of get_user() should always be checked. Fixes: 01d2f7e2cdd31 ("net/smc: sockopts TCP_NODELAY and TCP_CORK") Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/smc/af_smc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index c12a7fc18f56..6e5479067db0 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1456,7 +1456,8 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
if (optlen < sizeof(int))
return -EINVAL;
- get_user(val, (int __user *)optval);
+ if (get_user(val, (int __user *)optval))
+ return -EFAULT;
lock_sock(sk);
switch (optname) {