Skip to content

Commit

Permalink
net/smc: fix error return code in smc_setsockopt()
Browse files Browse the repository at this point in the history
Fix to return error code -EINVAL instead of 0 if optlen is invalid.

Fixes: 01d2f7e ("net/smc: sockopts TCP_NODELAY and TCP_CORK")
Signed-off-by: Wei Yongjun <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Wei Yongjun authored and davem330 committed Jun 3, 2018
1 parent 8cb7714 commit 3dc9f55
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/smc/af_smc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3dc9f55

Please sign in to comment.