Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Fix missing disable of kpreempt while getting interf...



details:   https://anonhg.NetBSD.org/src/rev/6edede86c9f1
branches:  trunk
changeset: 946421:6edede86c9f1
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Fri Nov 27 03:37:11 2020 +0000

description:
Fix missing disable of kpreempt while getting interface address

diffstat:

 sys/net/if_spppsubr.c |  20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diffs (75 lines):

diff -r 3d65dbf55996 -r 6edede86c9f1 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Thu Nov 26 23:13:55 2020 +0000
+++ b/sys/net/if_spppsubr.c     Fri Nov 27 03:37:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.214 2020/11/25 10:44:53 yamaguchi Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.215 2020/11/27 03:37:11 yamaguchi Exp $       */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.214 2020/11/25 10:44:53 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.215 2020/11/27 03:37:11 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3327,7 +3327,9 @@
        memset(&sp->dns_addrs, 0, sizeof sp->dns_addrs);
 
 #ifdef INET
+       kpreempt_disable();
        sppp_get_ip_addrs(sp, &myaddr, &hisaddr, 0);
+       kpreempt_enable();
 #else
        myaddr = hisaddr = 0;
 #endif
@@ -3809,10 +3811,13 @@
 
 #ifdef INET
        if (ISSET(sp->ipcp.opts, SPPP_IPCP_OPT_ADDRESS)) {
-               if (sp->ipcp.flags & IPCP_MYADDR_SEEN)
+               if (sp->ipcp.flags & IPCP_MYADDR_SEEN) {
                        ouraddr = sp->ipcp.req_myaddr;  /* not sure if this can ever happen */
-               else
+               } else {
+                       kpreempt_disable();
                        sppp_get_ip_addrs(sp, &ouraddr, 0, 0);
+                       kpreempt_enable();
+               }
                opt[i++] = IPCP_OPT_ADDRESS;
                opt[i++] = 6;
                opt[i++] = ouraddr >> 24;
@@ -3879,7 +3884,9 @@
        sp->ipv6cp.flags &= ~IPV6CP_MYIFID_SEEN;
 #endif
 
+       kpreempt_disable();
        sppp_get_ip6_addrs(sp, &myaddr, &hisaddr, 0);
+       kpreempt_enable();
        /*
         * If we don't have our address, this probably means our
         * interface doesn't want to talk IPv6 at all.  (This could
@@ -4308,7 +4315,10 @@
        KASSERT(SPPP_WLOCKED(sp));
 
        if (ISSET(sp->ipv6cp.opts, SPPP_IPV6CP_OPT_IFID)) {
+               kpreempt_disable();
                sppp_get_ip6_addrs(sp, &ouraddr, 0, 0);
+               kpreempt_enable();
+
                opt[i++] = IPV6CP_OPT_IFID;
                opt[i++] = 10;
                memcpy(&opt[i], &ouraddr.s6_addr[8], 8);
@@ -6056,7 +6066,9 @@
                status->state = sp->scp[IDX_IPCP].state;
                status->opts = sp->ipcp.opts;
 #ifdef INET
+               kpreempt_disable();
                sppp_get_ip_addrs(sp, &myaddr, 0, 0);
+               kpreempt_enable();
 #else
                myaddr = 0;
 #endif



Home | Main Index | Thread Index | Old Index