Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jul 2014 06:00:02 +0000 (UTC)
From:      Kevin Lo <kevlo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r268601 - head/sys/kern
Message-ID:  <201407140600.s6E602IZ054168@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevlo
Date: Mon Jul 14 06:00:01 2014
New Revision: 268601
URL: http://svnweb.freebsd.org/changeset/base/268601

Log:
  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:
  head/sys/kern/uipc_usrreq.c

Modified: head/sys/kern/uipc_usrreq.c
==============================================================================
--- head/sys/kern/uipc_usrreq.c	Mon Jul 14 04:38:17 2014	(r268600)
+++ head/sys/kern/uipc_usrreq.c	Mon Jul 14 06:00:01 2014	(r268601)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407140600.s6E602IZ054168>