Commit 271dbc31 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

sock: unlock on error in sock_setsockopt()

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

Fixes: d463126e ("net: sock: extend SO_TIMESTAMPING for PHC binding")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d7fba8ff
......@@ -1123,8 +1123,10 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
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;
......
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