On Tue, Apr 07, 2020 at 11:54:01AM +0200, Claudio Jeker wrote:
> Unsure about this one here. I would prefer if the panic remained for now
> (mainly because of the XXXSMP NET_UNLOCK() dance just above). I wonder if the
> order of this could not be modified so that the NET_LOCK is released after
> the RBT_REMOVE.
Well, let's clenup these dances before. Diff below just breaks giant
NET_LOCK() in pppxioctl() to many small.

Index: net/if_pppx.c
===================================================================
RCS file: /cvs/src/sys/net/if_pppx.c,v
retrieving revision 1.81
diff -u -p -r1.81 if_pppx.c
--- net/if_pppx.c       7 Apr 2020 07:11:22 -0000       1.81
+++ net/if_pppx.c       7 Apr 2020 10:46:34 -0000
@@ -433,7 +433,6 @@ pppxioctl(dev_t dev, u_long cmd, caddr_t
        struct pppx_dev *pxd = pppx_dev2pxd(dev);
        int error = 0;
 
-       NET_LOCK();
        switch (cmd) {
        case PIPEXSMODE:
                /*
@@ -447,46 +446,59 @@ pppxioctl(dev_t dev, u_long cmd, caddr_t
                break;
 
        case PIPEXASESSION:
+               NET_LOCK();
                error = pppx_add_session(pxd,
                    (struct pipex_session_req *)addr);
+               NET_UNLOCK();
                break;
 
        case PIPEXDSESSION:
+               NET_LOCK();
                error = pppx_del_session(pxd,
                    (struct pipex_session_close_req *)addr);
+               NET_UNLOCK();
                break;
 
        case PIPEXCSESSION:
+               NET_LOCK();
                error = pppx_config_session(pxd,
                    (struct pipex_session_config_req *)addr);
+               NET_UNLOCK();
                break;
 
        case PIPEXGSTAT:
+               NET_LOCK();
                error = pppx_get_stat(pxd,
                    (struct pipex_session_stat_req *)addr);
+               NET_UNLOCK();
                break;
 
        case PIPEXGCLOSED:
+               NET_LOCK();
                error = pppx_get_closed(pxd,
                    (struct pipex_session_list_req *)addr);
+               NET_UNLOCK();
                break;
 
        case PIPEXSIFDESCR:
+               NET_LOCK();
                error = pppx_set_session_descr(pxd,
                    (struct pipex_session_descr_req *)addr);
+               NET_UNLOCK();
                break;
 
        case FIONBIO:
                break;
        case FIONREAD:
+               NET_LOCK();
                *(int *)addr = mq_hdatalen(&pxd->pxd_svcq);
+               NET_UNLOCK();
                break;
 
        default:
                error = ENOTTY;
                break;
        }
-       NET_UNLOCK();
 
        return (error);
 }

Reply via email to