From: Dan Carpenter <dan.carpenter@oracle.com>
To: "David S. Miller" <davem@davemloft.net>, Yangbo Lu <yangbo.lu@nxp.com>
Cc: Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
Mat Martineau <mathew.j.martineau@linux.intel.com>,
Alexander Aring <aahringo@redhat.com>,
Miaohe Lin <linmiaohe@huawei.com>,
Florian Westphal <fw@strlen.de>,
Tonghao Zhang <xiangxia.m.yue@gmail.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH net] sock: unlock on error in sock_setsockopt()
Date: Wed, 7 Jul 2021 13:01:00 +0300 [thread overview]
Message-ID: <YOV7XH5Sqx+ZHghC@mwanda> (raw)
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>
---
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
next reply other threads:[~2021-07-07 10:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 10:01 Dan Carpenter [this message]
2021-07-08 4:00 ` [PATCH net] sock: unlock on error in sock_setsockopt() patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YOV7XH5Sqx+ZHghC@mwanda \
--to=dan.carpenter@oracle.com \
--cc=aahringo@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linmiaohe@huawei.com \
--cc=mathew.j.martineau@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=xiangxia.m.yue@gmail.com \
--cc=yangbo.lu@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox