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.f...@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.