Author: mmacy Date: Thu Jun 7 04:57:40 2018 New Revision: 334756 URL: https://svnweb.freebsd.org/changeset/base/334756
Log: AF_UNIX: check for unp == unp2 on disconnect Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Thu Jun 7 04:03:19 2018 (r334755) +++ head/sys/kern/uipc_usrreq.c Thu Jun 7 04:57:40 2018 (r334756) @@ -872,21 +872,19 @@ uipc_disconnect(struct socket *so) UNP_PCB_UNLOCK(unp); return (0); } - if (unp == unp2) { - if (unp_pcb_rele(unp) == 0) + if (__predict_true(unp != unp2)) { + unp_pcb_owned_lock2(unp, unp2, freed); + if (__predict_false(freed)) { UNP_PCB_UNLOCK(unp); + return (0); + } + unp_pcb_hold(unp2); } - unp_pcb_owned_lock2(unp, unp2, freed); - if (__predict_false(freed)) { - UNP_PCB_UNLOCK(unp); - return (0); - } - unp_pcb_hold(unp2); unp_pcb_hold(unp); unp_disconnect(unp, unp2); if (unp_pcb_rele(unp) == 0) UNP_PCB_UNLOCK(unp); - if (unp_pcb_rele(unp2) == 0) + if ((unp != unp2) && unp_pcb_rele(unp2) == 0) UNP_PCB_UNLOCK(unp2); return (0); } _______________________________________________ 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"