Commit 7a11455f authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

net/smc: unlock on error paths in __smc_setsockopt()

These two error paths need to release_sock(sk) before returning.

Fixes: a6a6fe27 ("net/smc: Dynamic control handshake limitation by socket options")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarD. Wythe <alibuda@linux.alibaba.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a7f4f13a
...@@ -2715,10 +2715,14 @@ static int __smc_setsockopt(struct socket *sock, int level, int optname, ...@@ -2715,10 +2715,14 @@ static int __smc_setsockopt(struct socket *sock, int level, int optname,
lock_sock(sk); lock_sock(sk);
switch (optname) { switch (optname) {
case SMC_LIMIT_HS: case SMC_LIMIT_HS:
if (optlen < sizeof(int)) if (optlen < sizeof(int)) {
return -EINVAL; rc = -EINVAL;
if (copy_from_sockptr(&val, optval, sizeof(int))) break;
return -EFAULT; }
if (copy_from_sockptr(&val, optval, sizeof(int))) {
rc = -EFAULT;
break;
}
smc->limit_smc_hs = !!val; smc->limit_smc_hs = !!val;
rc = 0; rc = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment