All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] sock: unlock on error in sock_setsockopt()
@ 2021-07-07 10:01 Dan Carpenter
  2021-07-08  4:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-07-07 10:01 UTC (permalink / raw)
  To: David S. Miller, Yangbo Lu
  Cc: Jakub Kicinski, Paolo Abeni, Eric Dumazet, Mat Martineau,
	Alexander Aring, Miaohe Lin, Florian Westphal, Tonghao Zhang,
	netdev, kernel-janitors

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] sock: unlock on error in sock_setsockopt()
  2021-07-07 10:01 [PATCH net] sock: unlock on error in sock_setsockopt() Dan Carpenter
@ 2021-07-08  4:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-07-08  4:00 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: davem, yangbo.lu, kuba, pabeni, edumazet, mathew.j.martineau,
	aahringo, linmiaohe, fw, xiangxia.m.yue, netdev, kernel-janitors

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-08  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 10:01 [PATCH net] sock: unlock on error in sock_setsockopt() Dan Carpenter
2021-07-08  4:00 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.