diff options
author | kevlo <kevlo@FreeBSD.org> | 2014-07-24 05:57:33 +0000 |
---|---|---|
committer | kevlo <kevlo@FreeBSD.org> | 2014-07-24 05:57:33 +0000 |
commit | 771984715d5e0ccbeee8672fb6637d3ece52fe0d (patch) | |
tree | c569610af2e8aa85423ef990570ec8ac44040188 /sys/kern | |
parent | af422c766614b6ba343291e97f2da605bfb88f40 (diff) | |
download | FreeBSD-src-771984715d5e0ccbeee8672fb6637d3ece52fe0d.zip FreeBSD-src-771984715d5e0ccbeee8672fb6637d3ece52fe0d.tar.gz |
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
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/uipc_usrreq.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 4fe59fc..2c225fb 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -467,6 +467,9 @@ uipc_bindat(int fd, struct socket *so, struct sockaddr *nam, struct thread *td) 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, struct sockaddr *nam, cap_rights_t rights; int error, len; + if (nam->sa_family != AF_UNIX) + return (EAFNOSUPPORT); + UNP_LINK_WLOCK_ASSERT(); unp = sotounpcb(so); |