Author: hselasky
Date: Wed Mar  7 13:32:52 2018
New Revision: 330586
URL: https://svnweb.freebsd.org/changeset/base/330586

Log:
  Make sure VNET is set when calling sa6_recoverscope() in ibcore.
  
  Else panic will occur when VIMAGE is enabled.
  
  MFC after:    1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/ofed/drivers/infiniband/core/ib_cma.c

Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c
==============================================================================
--- head/sys/ofed/drivers/infiniband/core/ib_cma.c      Wed Mar  7 13:30:38 
2018        (r330585)
+++ head/sys/ofed/drivers/infiniband/core/ib_cma.c      Wed Mar  7 13:32:52 
2018        (r330586)
@@ -3122,8 +3122,14 @@ static int cma_check_linklocal(struct rdma_dev_addr *d
 
        if (IN6_IS_SCOPE_LINKLOCAL(&sin6.sin6_addr) ||
            IN6_IS_ADDR_MC_INTFACELOCAL(&sin6.sin6_addr)) {
-               /* check if IPv6 scope ID is set */
-               if (sa6_recoverscope(&sin6) || sin6.sin6_scope_id == 0)
+               bool failure;
+
+               CURVNET_SET_QUIET(dev_addr->net);
+               failure = sa6_recoverscope(&sin6) || sin6.sin6_scope_id == 0;
+               CURVNET_RESTORE();
+
+               /* check if IPv6 scope ID is not set */
+               if (failure)
                        return -EINVAL;
                dev_addr->bound_dev_if = sin6.sin6_scope_id;
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to