From 7eea693fdb9b4eea9df8caa261ec2e8c58775fa0 Mon Sep 17 00:00:00 2001 From: asmodai Date: Tue, 13 Jun 2000 15:44:04 +0000 Subject: [PATCH] Fix panic by moving the prp == 0 check up the order of sanity checks. Submitted by: Bart Thate on -current Approved by: rwatson --- sys/kern/uipc_socket.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 73138112e1ca..b172d46b4df1 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -135,6 +135,9 @@ socreate(dom, aso, type, proto, p) else prp = pffindtype(dom, type); + if (prp == 0 || prp->pr_usrreqs->pru_attach == 0) + return (EPROTONOSUPPORT); + if (p->p_prison && jail_socket_unixiproute_only && prp->pr_domain->dom_family != PF_LOCAL && prp->pr_domain->dom_family != PF_INET && @@ -142,8 +145,6 @@ socreate(dom, aso, type, proto, p) return (EPROTONOSUPPORT); } - if (prp == 0 || prp->pr_usrreqs->pru_attach == 0) - return (EPROTONOSUPPORT); if (prp->pr_type != type) return (EPROTOTYPE); so = soalloc(p != 0);