diff mbox series

[net] sock: unlock on error in sock_setsockopt()

Message ID YOV7XH5Sqx+ZHghC@mwanda (mailing list archive)
State Accepted
Commit 271dbc31843244e5192f0f8a8be0da26995f944a
Delegated to: Netdev Maintainers
Headers show
Series [net] sock: unlock on error in sock_setsockopt() | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 5 this patch: 5
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 5 this patch: 5
netdev/header_inline success Link

Commit Message

Dan Carpenter July 7, 2021, 10:01 a.m. UTC
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(-)

Comments

patchwork-bot+netdevbpf@kernel.org July 8, 2021, 4 a.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Wed, 7 Jul 2021 13:01:00 +0300 you wrote:
> 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(-)

Here is the summary with links:
  - [net] sock: unlock on error in sock_setsockopt()
    https://git.kernel.org/netdev/net/c/271dbc318432

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

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(&timestamping, optval,
-					      sizeof(timestamping)))
-				return -EFAULT;
+					      sizeof(timestamping))) {
+				ret = -EFAULT;
+				break;
+			}
 		} else {
 			memset(&timestamping, 0, sizeof(timestamping));
 			timestamping.flags = val;