Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/smc: fix error return code in smc_setsockopt()

Fix to return error code -EINVAL instead of 0 if optlen is invalid.

Fixes: 01d2f7e2cdd3 ("net/smc: sockopts TCP_NODELAY and TCP_CORK")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Wei Yongjun and committed by
David S. Miller
3dc9f558 8cb77149

+1 -1
+1 -1
net/smc/af_smc.c
··· 1420 1420 return rc; 1421 1421 1422 1422 if (optlen < sizeof(int)) 1423 - return rc; 1423 + return -EINVAL; 1424 1424 get_user(val, (int __user *)optval); 1425 1425 1426 1426 lock_sock(sk);