On Mon, May 15, 2017 at 01:20:02PM +0200, Martin Pieuchot wrote:
> Here's the last of the splsoftnet(), is it ok if I replace it with a
> KERNEL_LOCK() to make it clear this needs protection?

I think it needs the socket lock.  somove() is modifying the
so_splicelen value.  somove() calls soassertlocked().

bluhm

> 
> Index: kern/uipc_socket.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/uipc_socket.c,v
> retrieving revision 1.182
> diff -u -p -r1.182 uipc_socket.c
> --- kern/uipc_socket.c        2 Apr 2017 23:40:08 -0000       1.182
> +++ kern/uipc_socket.c        15 May 2017 11:18:21 -0000
> @@ -1860,12 +1862,12 @@ sogetopt(struct socket *so, int level, i
>               case SO_SPLICE:
>                   {
>                       off_t len;
> -                     int s = splsoftnet();
>  
> +                     KERNEL_LOCK();
>                       m->m_len = sizeof(off_t);
>                       len = so->so_sp ? so->so_sp->ssp_len : 0;
>                       memcpy(mtod(m, off_t *), &len, sizeof(off_t));
> -                     splx(s);
> +                     KERNEL_UNLOCK();
>                       break;
>                   }
>  #endif /* SOCKET_SPLICE */

Reply via email to