All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: add mutex_unlock on xfrm4_protocol_register
@ 2018-04-19  1:08 sunlianwen
  2018-04-19  5:18 ` Steffen Klassert
  0 siblings, 1 reply; 2+ messages in thread
From: sunlianwen @ 2018-04-19  1:08 UTC (permalink / raw)
  To: netdev

The function of xfrm4_protocol_register() don't release
the mutx lock, which potential cause deadlock.

Signed-off-by: Lianwen Sun <sunlw.fnst@cn.fujitsu.com>
---
 net/ipv4/xfrm4_protocol.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ipv4/xfrm4_protocol.c b/net/ipv4/xfrm4_protocol.c
index 8dd0e6ab8606..1ee34edef9d2 100644
--- a/net/ipv4/xfrm4_protocol.c
+++ b/net/ipv4/xfrm4_protocol.c
@@ -240,6 +240,10 @@ int xfrm4_protocol_register(struct xfrm4_protocol *handler,
 
 	ret = 0;
 
+	mutex_unlock(&xfrm4_protocol_mutex);
+
+	return ret;
+
 err:
 	mutex_unlock(&xfrm4_protocol_mutex);
 
-- 
2.17.0
.

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

* Re: [PATCH] net: add mutex_unlock on xfrm4_protocol_register
  2018-04-19  1:08 [PATCH] net: add mutex_unlock on xfrm4_protocol_register sunlianwen
@ 2018-04-19  5:18 ` Steffen Klassert
  0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2018-04-19  5:18 UTC (permalink / raw)
  To: sunlianwen; +Cc: netdev

On Thu, Apr 19, 2018 at 09:08:57AM +0800, sunlianwen wrote:
> The function of xfrm4_protocol_register() don't release
> the mutx lock, which potential cause deadlock.

Can you please explain how this can happen?

> 
> Signed-off-by: Lianwen Sun <sunlw.fnst@cn.fujitsu.com>
> ---
>  net/ipv4/xfrm4_protocol.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/ipv4/xfrm4_protocol.c b/net/ipv4/xfrm4_protocol.c
> index 8dd0e6ab8606..1ee34edef9d2 100644
> --- a/net/ipv4/xfrm4_protocol.c
> +++ b/net/ipv4/xfrm4_protocol.c
> @@ -240,6 +240,10 @@ int xfrm4_protocol_register(struct xfrm4_protocol *handler,
>  
>  	ret = 0;
>  
> +	mutex_unlock(&xfrm4_protocol_mutex);
> +
> +	return ret;
> +
>  err:
>  	mutex_unlock(&xfrm4_protocol_mutex);

Did you test this patch?

I'm sure you did not. You return before the protocol
is registered, this breaks IPsec for IPv4 completely.

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

end of thread, other threads:[~2018-04-19  5:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19  1:08 [PATCH] net: add mutex_unlock on xfrm4_protocol_register sunlianwen
2018-04-19  5:18 ` Steffen Klassert

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.