Index: udp6_usrreq.c =================================================================== RCS file: /home/ncvs/src/sys/netinet6/udp6_usrreq.c,v retrieving revision 1.79 diff -u -r1.79 udp6_usrreq.c --- udp6_usrreq.c 23 Jul 2007 07:58:58 -0000 1.79 +++ udp6_usrreq.c 26 Jul 2007 11:46:16 -0000 @@ -454,15 +454,19 @@ return (ENOENT); } INP_LOCK(inp); - KASSERT(inp->inp_socket != NULL, - ("udp6_getcred: inp_socket == NULL")); - /* - * XXXRW: There should be a scoping access control check here. - */ + if (inp->inp_socket == NULL) { + error = ENOENT; + goto out; + } + error = cr_canseesocket(req->td->td_ucred, inp->inp_socket); + if (error) + goto out; cru2x(inp->inp_socket->so_cred, &xuc); +out: INP_UNLOCK(inp); INP_INFO_RUNLOCK(&udbinfo); - error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred)); + if (error == 0) + error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred)); return (error); }