mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
net/smc: unlock on error paths in __smc_setsockopt()
These two error paths need to release_sock(sk) before returning.
Fixes: a6a6fe27ba
("net/smc: Dynamic control handshake limitation by socket options")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: D. Wythe <alibuda@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a7f4f13a0a
commit
7a11455f37
@ -2715,10 +2715,14 @@ static int __smc_setsockopt(struct socket *sock, int level, int optname,
|
||||
lock_sock(sk);
|
||||
switch (optname) {
|
||||
case SMC_LIMIT_HS:
|
||||
if (optlen < sizeof(int))
|
||||
return -EINVAL;
|
||||
if (copy_from_sockptr(&val, optval, sizeof(int)))
|
||||
return -EFAULT;
|
||||
if (optlen < sizeof(int)) {
|
||||
rc = -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (copy_from_sockptr(&val, optval, sizeof(int))) {
|
||||
rc = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
smc->limit_smc_hs = !!val;
|
||||
rc = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user