Date: Thu, 11 Dec 2003 15:21:57 -0800 (PST) From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 43832 for review Message-ID: <200312112321.hBBNLveu054527@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=43832 Change 43832 by sam@sam_ebb on 2003/12/11 15:21:22 drop locks before calling sonewconn to avoid recursion on the unpcb head lock and to avoid holding locks over malloc Affected files ... .. //depot/projects/netperf+sockets/sys/kern/uipc_usrreq.c#5 edit Differences ... ==== //depot/projects/netperf+sockets/sys/kern/uipc_usrreq.c#5 (text+ko) ==== @@ -839,8 +839,19 @@ goto bad; } if (so->so_proto->pr_flags & PR_CONNREQUIRED) { - if ((so2->so_options & SO_ACCEPTCONN) == 0 || - (so3 = sonewconn(so2, 0)) == 0) { + if (so2->so_options & SO_ACCEPTCONN) { + /* + * NB: drop locks here so unp_attach is entered + * w/o locks; this avoids a recursive lock + * of the head and holding sleep locks across + * a (potentially) blocking malloc. + */ + UNP_EXIT(unp); + so3 = sonewconn(so2, 0); + UNP_ENTER(unp); + } else + so3 = 0; + if (so3 == 0) { error = ECONNREFUSED; goto bad; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200312112321.hBBNLveu054527>