sock: unlock on error in sock_setsockopt()

If copy_from_sockptr() then we need to unlock before returning.

Fixes: d463126e23 ("net: sock: extend SO_TIMESTAMPING for PHC binding")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Dan Carpenter 2021-07-07 13:01:00 +03:00 committed by David S. Miller
parent d7fba8ff3e
commit 271dbc3184

View File

@ -1123,8 +1123,10 @@ set_sndbuf:
case SO_TIMESTAMPING_OLD:
if (optlen == sizeof(timestamping)) {
if (copy_from_sockptr(&timestamping, optval,
sizeof(timestamping)))
return -EFAULT;
sizeof(timestamping))) {
ret = -EFAULT;
break;
}
} else {
memset(&timestamping, 0, sizeof(timestamping));
timestamping.flags = val;