Author: mmacy
Date: Thu May 24 18:22:05 2018
New Revision: 334174
URL: https://svnweb.freebsd.org/changeset/base/334174

Log:
  AF_UNIX in connectat unp and unp2 can be the same

Modified:
  head/sys/kern/uipc_usrreq.c

Modified: head/sys/kern/uipc_usrreq.c
==============================================================================
--- head/sys/kern/uipc_usrreq.c Thu May 24 18:02:02 2018        (r334173)
+++ head/sys/kern/uipc_usrreq.c Thu May 24 18:22:05 2018        (r334174)
@@ -1610,14 +1610,18 @@ unp_connectat(int fd, struct socket *so, struct sockad
                mac_socketpeer_set_from_socket(so, so2);
                mac_socketpeer_set_from_socket(so2, so);
 #endif
-       } else
-               unp_pcb_lock2(unp, unp2);
-
+       } else {
+               if (unp == unp2)
+                       UNP_PCB_LOCK(unp);
+               else
+                       unp_pcb_lock2(unp, unp2);
+       }
        KASSERT(unp2 != NULL && so2 != NULL && unp2->unp_socket == so2 &&
            sotounpcb(so2) == unp2,
            ("%s: unp2 %p so2 %p", __func__, unp2, so2));
        error = unp_connect2(so, so2, PRU_CONNECT);
-       UNP_PCB_UNLOCK(unp2);
+       if (unp != unp2)
+               UNP_PCB_UNLOCK(unp2);
        UNP_PCB_UNLOCK(unp);
 bad2:
        mtx_unlock(vplock);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to