summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-07-07 13:01:00 +0300
committerDavid S. Miller <davem@davemloft.net>2021-07-07 20:49:12 -0700
commit271dbc31843244e5192f0f8a8be0da26995f944a (patch)
tree15474ecabbcae87c4f6e36c351d657b4c04e5781 /net
parentd7fba8ff3e50fb25ffe583bf945df052f6caffa2 (diff)
downloadlinux-271dbc31843244e5192f0f8a8be0da26995f944a.tar.bz2
sock: unlock on error in sock_setsockopt()
If copy_from_sockptr() then we need to unlock before returning. Fixes: d463126e23f1 ("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>
Diffstat (limited to 'net')
-rw-r--r--net/core/sock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 1c4b0468bc2c..a3eea6e0b30a 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -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;