net/smc: fix error return code in smc_setsockopt()
authorWei Yongjun <weiyongjun1@huawei.com>
Thu, 31 May 2018 02:31:22 +0000 (02:31 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 3 Jun 2018 14:38:28 +0000 (10:38 -0400)
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>
net/smc/af_smc.c

index 2c369d4..973b447 100644 (file)
@@ -1420,7 +1420,7 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
                return rc;
 
        if (optlen < sizeof(int))
-               return rc;
+               return -EINVAL;
        get_user(val, (int __user *)optval);
 
        lock_sock(sk);