Author: glebius
Date: Wed Oct  9 05:52:07 2019
New Revision: 353336
URL: https://svnweb.freebsd.org/changeset/base/353336

Log:
  Revert changes to rip6_bind() from r353292.  This function is always
  called in syscall context, so it must enter epoch itself.  This
  changeset originates from early version of the patch, and somehow
  slipped to the final version.
  
  Reported by:  pho

Modified:
  head/sys/netinet6/raw_ip6.c

Modified: head/sys/netinet6/raw_ip6.c
==============================================================================
--- head/sys/netinet6/raw_ip6.c Wed Oct  9 05:28:10 2019        (r353335)
+++ head/sys/netinet6/raw_ip6.c Wed Oct  9 05:52:07 2019        (r353336)
@@ -734,12 +734,12 @@ rip6_disconnect(struct socket *so)
 static int
 rip6_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
 {
+       struct epoch_tracker et;
        struct inpcb *inp;
        struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam;
        struct ifaddr *ifa = NULL;
        int error = 0;
 
-       NET_EPOCH_ASSERT();
        inp = sotoinpcb(so);
        KASSERT(inp != NULL, ("rip6_bind: inp == NULL"));
 
@@ -752,14 +752,20 @@ rip6_bind(struct socket *so, struct sockaddr *nam, str
        if ((error = sa6_embedscope(addr, V_ip6_use_defzone)) != 0)
                return (error);
 
+       NET_EPOCH_ENTER(et);
        if (!IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr) &&
-           (ifa = ifa_ifwithaddr((struct sockaddr *)addr)) == NULL)
+           (ifa = ifa_ifwithaddr((struct sockaddr *)addr)) == NULL) {
+               NET_EPOCH_EXIT(et);
                return (EADDRNOTAVAIL);
+       }
        if (ifa != NULL &&
            ((struct in6_ifaddr *)ifa)->ia6_flags &
            (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|
-            IN6_IFF_DETACHED|IN6_IFF_DEPRECATED))
+            IN6_IFF_DETACHED|IN6_IFF_DEPRECATED)) {
+               NET_EPOCH_EXIT(et);
                return (EADDRNOTAVAIL);
+       }
+       NET_EPOCH_EXIT(et);
        INP_INFO_WLOCK(&V_ripcbinfo);
        INP_WLOCK(inp);
        inp->in6p_laddr = addr->sin6_addr;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to