On 15/05/17(Mon) 13:35, Alexander Bluhm wrote:
> 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().

Fine, updated diff below.

Index: kern/uipc_socket.c
===================================================================
RCS file: /cvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.183
diff -u -p -r1.183 uipc_socket.c
--- kern/uipc_socket.c  15 May 2017 12:26:00 -0000      1.183
+++ kern/uipc_socket.c  15 May 2017 12:31:39 -0000
@@ -1862,12 +1862,13 @@ sogetopt(struct socket *so, int level, i
                case SO_SPLICE:
                    {
                        off_t len;
-                       int s = splsoftnet();
+                       int s;
 
+                       s = solock(so);
                        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);
+                       sounlock(s);
                        break;
                    }
 #endif /* SOCKET_SPLICE */

Reply via email to