[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 7 Jul 2021 13:01:00 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: "David S. Miller" <davem@...emloft.net>,
Yangbo Lu <yangbo.lu@....com>
Cc: Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Mat Martineau <mathew.j.martineau@...ux.intel.com>,
Alexander Aring <aahringo@...hat.com>,
Miaohe Lin <linmiaohe@...wei.com>,
Florian Westphal <fw@...len.de>,
Tonghao Zhang <xiangxia.m.yue@...il.com>,
netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH net] 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@...cle.com>
---
net/core/sock.c | 6 ++++--
1 file 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 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
case SO_TIMESTAMPING_OLD:
if (optlen == sizeof(timestamping)) {
if (copy_from_sockptr(×tamping, optval,
- sizeof(timestamping)))
- return -EFAULT;
+ sizeof(timestamping))) {
+ ret = -EFAULT;
+ break;
+ }
} else {
memset(×tamping, 0, sizeof(timestamping));
timestamping.flags = val;
--
2.30.2
Powered by blists - more mailing lists