On Tue, Sep 20, 2016 at 05:09:41PM +0200, Martin Pieuchot wrote:
> On 20/09/16(Tue) 10:51, 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.
> 
> Diff below should fix that.  I'd rather keep the splsoftnet() close
> to ifioctl() because that's where the lock is going to be taken.
> 

This one fixes that problem as well.

> ok?
> 
> Index: net/if.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if.c,v
> retrieving revision 1.448
> diff -u -p -r1.448 if.c
> --- net/if.c  13 Sep 2016 08:15:01 -0000      1.448
> +++ net/if.c  20 Sep 2016 15:07: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,8 +1050,11 @@ if_clone_create(const char *name, int rd
>       if (ifunit(name) != NULL)
>               return (EEXIST);
>  
> -     if ((ret = (*ifc->ifc_create)(ifc, unit)) != 0 ||
> -         (ifp = ifunit(name)) == NULL)
> +     s = splsoftnet();
> +     ret = (*ifc->ifc_create)(ifc, unit);
> +     splx(s);
> +
> +     if (ret != 0 || (ifp = ifunit(name)) == NULL)
>               return (ret);
>  
>       if_addgroup(ifp, ifc->ifc_name);
> 

Reply via email to