net/smc: add error handling for get_user()
For security reasons the return code of get_user() should always be
checked.
Fixes: 01d2f7e2cd ("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>
This commit is contained in:
committed by
David S. Miller
parent
99be51f11d
commit
ac0107edba
@@ -1456,7 +1456,8 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
|
|||||||
|
|
||||||
if (optlen < sizeof(int))
|
if (optlen < sizeof(int))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
get_user(val, (int __user *)optval);
|
if (get_user(val, (int __user *)optval))
|
||||||
|
return -EFAULT;
|
||||||
|
|
||||||
lock_sock(sk);
|
lock_sock(sk);
|
||||||
switch (optname) {
|
switch (optname) {
|
||||||
|
|||||||
Reference in New Issue
Block a user