svn commit: r269044 - stable/10/sys/kern

Kevin Lo kevlo at FreeBSD.org
Thu Jul 24 05:57:34 UTC 2014


Author: kevlo
Date: Thu Jul 24 05:57:33 2014
New Revision: 269044
URL: http://svnweb.freebsd.org/changeset/base/269044

Log:
  MFC r268601:
  
  Make bind(2) and connect(2) return EAFNOSUPPORT for AF_UNIX on wrong
  address family.
  
  See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191586 for the
  original discussion.
  
  Reviewed by:	terry

Modified:
  stable/10/sys/kern/uipc_usrreq.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/uipc_usrreq.c
==============================================================================
--- stable/10/sys/kern/uipc_usrreq.c	Thu Jul 24 05:31:57 2014	(r269043)
+++ stable/10/sys/kern/uipc_usrreq.c	Thu Jul 24 05:57:33 2014	(r269044)
@@ -467,6 +467,9 @@ uipc_bindat(int fd, struct socket *so, s
 	cap_rights_t rights;
 	char *buf;
 
+	if (nam->sa_family != AF_UNIX)
+		return (EAFNOSUPPORT);
+
 	unp = sotounpcb(so);
 	KASSERT(unp != NULL, ("uipc_bind: unp == NULL"));
 
@@ -1278,6 +1281,9 @@ unp_connectat(int fd, struct socket *so,
 	cap_rights_t rights;
 	int error, len;
 
+	if (nam->sa_family != AF_UNIX)
+		return (EAFNOSUPPORT);
+
 	UNP_LINK_WLOCK_ASSERT();
 
 	unp = sotounpcb(so);


More information about the svn-src-stable-10 mailing list