From 7b574f2e4563fc32e0f2d3f14a3abde2c7581fb8 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Fri, 18 Jun 2004 04:02:56 +0000 Subject: [PATCH] Hold SOCK_LOCK(so) while frobbing so_options. Note that while the local race is corrected, there's still a global race in sosend() relating to so_options and the SO_DONTROUTE flag. --- sys/kern/uipc_socket.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 364f2db2465e..f2f7d1d55e0d 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -778,8 +778,11 @@ sosend(so, addr, uio, top, control, flags, td) (resid > 0 && space > 0) ? PRUS_MORETOCOME : 0, top, addr, control, td); splx(s); - if (dontroute) + if (dontroute) { + SOCK_LOCK(so); so->so_options &= ~SO_DONTROUTE; + SOCK_UNLOCK(so); + } clen = 0; control = NULL; top = NULL;