Kill two simple recursive splsoftnet().

- pr_usrreq() functions are always called under NET_LOCK().
- tcp_ident() is called by tcp_sysctl() only which asserts for the NET_LOCK()

ok?

Index: netinet/ip_gre.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_gre.c,v
retrieving revision 1.59
diff -u -p -r1.59 ip_gre.c
--- netinet/ip_gre.c    4 Mar 2016 22:38:23 -0000       1.59
+++ netinet/ip_gre.c    2 Jan 2017 11:34:01 -0000
@@ -411,12 +411,10 @@ gre_usrreq(struct socket *so, int req, s
        struct inpcb *inp = sotoinpcb(so);
 
        if (inp != NULL && inp->inp_pipex && req == PRU_SEND) {
-               int s;
                struct sockaddr_in *sin4;
                struct in_addr *ina_dst;
                struct pipex_session *session;
 
-               s = splsoftnet();
                ina_dst = NULL;
                if ((so->so_state & SS_ISCONNECTED) != 0) {
                        inp = sotoinpcb(so);
@@ -432,7 +430,6 @@ gre_usrreq(struct socket *so, int req, s
                    (session = pipex_pptp_userland_lookup_session_ipv4(m,
                            *ina_dst)))
                        m = pipex_pptp_userland_output(m, session);
-               splx(s);
 
                if (m == NULL)
                        return (ENOMEM);
Index: netinet/tcp_usrreq.c
===================================================================
RCS file: /cvs/src/sys/netinet/tcp_usrreq.c,v
retrieving revision 1.140
diff -u -p -r1.140 tcp_usrreq.c
--- netinet/tcp_usrreq.c        26 Dec 2016 21:30:10 -0000      1.140
+++ netinet/tcp_usrreq.c        2 Jan 2017 11:30:56 -0000
@@ -732,7 +732,7 @@ tcp_usrclosed(struct tcpcb *tp)
 int
 tcp_ident(void *oldp, size_t *oldlenp, void *newp, size_t newlen, int dodrop)
 {
-       int error = 0, s;
+       int error = 0;
        struct tcp_ident_mapping tir;
        struct inpcb *inp;
        struct tcpcb *tp = NULL;
@@ -741,6 +741,9 @@ tcp_ident(void *oldp, size_t *oldlenp, v
        struct sockaddr_in6 *fin6, *lin6;
        struct in6_addr f6, l6;
 #endif
+
+       splsoftassert(IPL_SOFTNET);
+
        if (dodrop) {
                if (oldp != NULL || *oldlenp != 0)
                        return (EINVAL);
@@ -781,7 +784,6 @@ tcp_ident(void *oldp, size_t *oldlenp, v
                return (EINVAL);
        }
 
-       s = splsoftnet();
        switch (tir.faddr.ss_family) {
 #ifdef INET6
        case AF_INET6:
@@ -803,7 +805,6 @@ tcp_ident(void *oldp, size_t *oldlenp, v
                        tp = tcp_drop(tp, ECONNABORTED);
                else
                        error = ESRCH;
-               splx(s);
                return (error);
        }
 
@@ -830,7 +831,6 @@ tcp_ident(void *oldp, size_t *oldlenp, v
                tir.ruid = -1;
                tir.euid = -1;
        }
-       splx(s);
 
        *oldlenp = sizeof (tir);
        error = copyout((void *)&tir, oldp, sizeof (tir));

Reply via email to