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 curlwp_bind() for ifa_release(), ok'ed b...



details:   https://anonhg.NetBSD.org/src/rev/7e2f10e6e86b
branches:  trunk
changeset: 1024472:7e2f10e6e86b
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Mon Oct 25 02:06:29 2021 +0000

description:
Fix missing curlwp_bind() for ifa_release(), ok'ed by yamaguchi@n.o.

This causes the following KASSERT failure in pppoe server.
    - sppp_rcr_event()
      - sppp_ipcp_confreq()
        - sppp_get_ip_addrs()
          - psref_release()

After if_spppsubr.c:1.227, sppp_ipcp_confreq() is done in workqueue
instead of softint.

diffstat:

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

diffs (68 lines):

diff -r a944cad243a4 -r 7e2f10e6e86b sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Mon Oct 25 01:06:13 2021 +0000
+++ b/sys/net/if_spppsubr.c     Mon Oct 25 02:06:29 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.259 2021/10/11 05:13:11 knakahara Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.260 2021/10/25 02:06:29 knakahara Exp $       */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.259 2021/10/11 05:13:11 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.260 2021/10/25 02:06:29 knakahara Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -5591,7 +5591,7 @@
        struct ifaddr *ifa;
        struct sockaddr_in *si, *sm;
        uint32_t ssrc, ddst;
-       int s;
+       int bound, s;
        struct psref psref;
 
        sm = NULL;
@@ -5601,6 +5601,7 @@
         * aliases don't make any sense on a p2p link anyway.
         */
        si = 0;
+       bound = curlwp_bind();
        s = pserialize_read_enter();
        IFADDR_READER_FOREACH(ifa, ifp) {
                if (ifa->ifa_addr->sa_family == AF_INET) {
@@ -5625,6 +5626,7 @@
                        ddst = si->sin_addr.s_addr;
                ifa_release(ifa, &psref);
        }
+       curlwp_bindx(bound);
 
        if (dst) *dst = ntohl(ddst);
        if (src) *src = ntohl(ssrc);
@@ -5783,7 +5785,7 @@
        struct ifaddr *ifa;
        struct sockaddr_in6 *si, *sm;
        struct in6_addr ssrc, ddst;
-       int s;
+       int bound, s;
        struct psref psref;
 
        sm = NULL;
@@ -5794,6 +5796,7 @@
         * aliases don't make any sense on a p2p link anyway.
         */
        si = 0;
+       bound = curlwp_bind();
        s = pserialize_read_enter();
        IFADDR_READER_FOREACH(ifa, ifp) {
                if (ifa->ifa_addr->sa_family == AF_INET6) {
@@ -5821,6 +5824,7 @@
                        memcpy(&ddst, &si->sin6_addr, sizeof(ddst));
                ifa_release(ifa, &psref);
        }
+       curlwp_bindx(bound);
 
        if (dst)
                memcpy(dst, &ddst, sizeof(*dst));



Home | Main Index | Thread Index | Old Index