Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jan 2012 21:25:48 -0800
From:      Navdeep Parhar <nparhar@gmail.com>
To:        freebsd-net@freebsd.org
Subject:   tcp_detach can return with inpcb lock held
Message-ID:  <CAPFoGT-S-gvp12dGBZewEEZUFrWaOL=V4Jotu-pgzOEpcHs7Xg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Looks like there's a case where tcp_detach could return with the inp
lock held.  I see an XXXRW comment questioning this possibility, but
we should either add an assertion to verify that the case does not
occur, or unlock the inpcb before returning.  Or maybe both?

Regards,
Navdeep

diff -r 35bdf8d932e8 sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c  Mon Dec 19 10:08:31 2011 -0800
+++ b/sys/netinet/tcp_usrreq.c  Thu Jan 05 21:20:24 2012 -0800
@@ -204,8 +204,11 @@
                        tcp_discardcb(tp);
                        in_pcbdetach(inp);
                        in_pcbfree(inp);
-               } else
+               } else {
                        in_pcbdetach(inp);
+                       INP_WUNLOCK(inp);
+               }
+
        }
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPFoGT-S-gvp12dGBZewEEZUFrWaOL=V4Jotu-pgzOEpcHs7Xg>