On Tue, Sep 20, 2016 at 05:04:02PM +0200, Mike Belopuhov wrote:
> On Tue, Sep 20, 2016 at 10:51 -0400, David Hill wrote:
> > On Tue, Sep 20, 2016 at 09:53:02AM -0400, David Hill wrote:
> > > More...
> > > 
> > > splassert: sorwakeup: want 5 have 0
> > > Starting stack trace...
> > > splassert_check() at splassert_check+0x78
> > > sorwakeup() at sorwakeup+0x27
> > > route_input() at route_input+0x284
> > > pflog_clone_create() at pflog_clone_create+0xa4
> > > if_clone_create() at if_clone_create+0x7f
> > > ifioctl() at ifioctl+0x35a
> > > sys_ioctl() at sys_ioctl+0x196
> > > syscall() at syscall+0x27b
> > > --- syscall (number 54) ---
> > > end of kernel
> > > end trace frame: 0x7f7ffffc7930, count: 249
> > > 0x1aeaedf1af1a:
> > > End of stack trace.
> > > 
> > >
> > 
> > Another similar...
> > 
> > Sep 20 10:33:25 olive /bsd: splassert: sorwakeup: want 5 have 0
> > Sep 20 10:33:25 olive /bsd: Starting stack trace...
> > Sep 20 10:33:25 olive /bsd: splassert_check() at splassert_check+0x78
> > Sep 20 10:33:25 olive /bsd: sorwakeup() at sorwakeup+0x27
> > Sep 20 10:33:25 olive /bsd: route_input() at route_input+0x284
> > Sep 20 10:33:25 olive /bsd: vether_clone_create() at
> > vether_clone_create+0xd9
> > Sep 20 10:33:25 olive /bsd: if_clone_create() at if_clone_create+0x7f
> > Sep 20 10:33:25 olive /bsd: ifioctl() at ifioctl+0x35a
> > Sep 20 10:33:25 olive /bsd: sys_ioctl() at sys_ioctl+0x196
> > Sep 20 10:33:25 olive /bsd: syscall() at syscall+0x27b
> > Sep 20 10:33:25 olive /bsd: --- syscall (number 54) ---
> > Sep 20 10:33:25 olive /bsd: end of kernel
> > Sep 20 10:33:25 olive /bsd: end trace frame: 0x7f7ffffd0df1, count: 249
> > Sep 20 10:33:25 olive /bsd: 0x119ca1c1af1a:
> > Sep 20 10:33:25 olive /bsd: End of stack trace.
> >  
> > 
> 
> It's all the same.  I'm not certain what would be the best way to
> go around this, but a cautious approach would be something like this:
> just wrapping ifc_create, ifc_destroy in splsoftnet.
> 
> David, can you give this a spin?
> 
> Index: sys/net/if.c
> ===================================================================
> RCS file: /home/cvs/src/sys/net/if.c,v
> retrieving revision 1.448
> diff -u -p -r1.448 if.c
> --- sys/net/if.c      13 Sep 2016 08:15:01 -0000      1.448
> +++ sys/net/if.c      20 Sep 2016 14:58:57 -0000
> @@ -1041,7 +1041,7 @@ if_clone_create(const char *name, int rd
>  {
>       struct if_clone *ifc;
>       struct ifnet *ifp;
> -     int unit, ret;
> +     int unit, ret, s;
>  
>       ifc = if_clone_lookup(name, &unit);
>       if (ifc == NULL)
> @@ -1050,9 +1050,13 @@ if_clone_create(const char *name, int rd
>       if (ifunit(name) != NULL)
>               return (EEXIST);
>  
> +     s = splsoftnet();
>       if ((ret = (*ifc->ifc_create)(ifc, unit)) != 0 ||
> -         (ifp = ifunit(name)) == NULL)
> +         (ifp = ifunit(name)) == NULL) {
> +             splx(s);
>               return (ret);
> +     }
> +     splx(s);
>  
>       if_addgroup(ifp, ifc->ifc_name);
>       if (rdomain != 0)
> @@ -1069,7 +1073,7 @@ if_clone_destroy(const char *name)
>  {
>       struct if_clone *ifc;
>       struct ifnet *ifp;
> -     int s;
> +     int error, s;
>  
>       ifc = if_clone_lookup(name, NULL);
>       if (ifc == NULL)
> @@ -1088,7 +1092,10 @@ if_clone_destroy(const char *name)
>               splx(s);
>       }
>  
> -     return ((*ifc->ifc_destroy)(ifp));
> +     s = splsoftnet();
> +     error = (*ifc->ifc_destroy)(ifp);
> +     splx(s);
> +     return (error);
>  }
>  
>  /*
>

Works.  No more assert and functions normally. 

Reply via email to