Skip to contentSkip to conversation

sock: unlock on error in sock_setsockopt()

PATCH Applied Dan Carpenter 2 participants 2 messages Jul 7, 2021 – Jul 8, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 net/core/sock.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/core/sock.c +4 -2
index 1c4b0468bc2c..a3eea6e0b30a 100644
@@ -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;
Signature · 1 line
2.30.2
#1 lore raw
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

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

Quoted 7 lines · 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")
---
 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