Module Name:    src
Committed By:   ozaki-r
Date:           Thu May 10 01:32:24 UTC 2018

Modified Files:
        src/sys/compat/linux/common: linux_socket.c
        src/sys/compat/linux32/common: linux32_socket.c

Log Message:
Fix pserialize enter/exit pairs in linux_getifconf and linux32_getifconf

Tested by using a small linux program that uses ioctl(SIOCGIFCONF).
Probably fix PR kern/53259 as well.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/compat/linux/common/linux_socket.c
cvs rdiff -u -r1.28 -r1.29 src/sys/compat/linux32/common/linux32_socket.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/linux/common/linux_socket.c
diff -u src/sys/compat/linux/common/linux_socket.c:1.141 src/sys/compat/linux/common/linux_socket.c:1.142
--- src/sys/compat/linux/common/linux_socket.c:1.141	Thu May  3 21:43:33 2018
+++ src/sys/compat/linux/common/linux_socket.c	Thu May 10 01:32:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socket.c,v 1.141 2018/05/03 21:43:33 christos Exp $	*/
+/*	$NetBSD: linux_socket.c,v 1.142 2018/05/10 01:32:24 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.141 2018/05/03 21:43:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.142 2018/05/10 01:32:24 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1183,7 +1183,7 @@ linux_getifconf(struct lwp *l, register_
 			ifa_release(ifa, &psref_ifa);
 		}
 
-		s = pserialize_read_enter();
+		KASSERT(pserialize_in_read_section());
 		if_release(ifp, &psref);
 	}
 	pserialize_read_exit(s);

Index: src/sys/compat/linux32/common/linux32_socket.c
diff -u src/sys/compat/linux32/common/linux32_socket.c:1.28 src/sys/compat/linux32/common/linux32_socket.c:1.29
--- src/sys/compat/linux32/common/linux32_socket.c:1.28	Wed Nov 22 10:19:14 2017
+++ src/sys/compat/linux32/common/linux32_socket.c	Thu May 10 01:32:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_socket.c,v 1.28 2017/11/22 10:19:14 ozaki-r Exp $ */
+/*	$NetBSD: linux32_socket.c,v 1.29 2018/05/10 01:32:24 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.28 2017/11/22 10:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.29 2018/05/10 01:32:24 ozaki-r Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -478,7 +478,7 @@ linux32_getifconf(struct lwp *l, registe
 			ifa_release(ifa, &psref_ifa);
 		}
 
-		s = pserialize_read_enter();
+		KASSERT(pserialize_in_read_section());
 		if_release(ifp, &psref);
 	}
 	pserialize_read_exit(s);

Reply via email to