diff options
author | 2020-02-22 11:58:29 +0000 | |
---|---|---|
committer | 2020-02-22 11:58:29 +0000 | |
commit | 60e616d4462a6e14a239d984c6c9a30c8c69bf3b (patch) | |
tree | 07237b50bf2feddfa4e765a8d10d3c4023ffbb9a | |
parent | Avoid duplication in the code that sends headers (diff) | |
download | wireguard-openbsd-60e616d4462a6e14a239d984c6c9a30c8c69bf3b.tar.xz wireguard-openbsd-60e616d4462a6e14a239d984c6c9a30c8c69bf3b.zip |
In preparation for unlocking ioctl(2), grab the kernel lock as needed.
ok kettenis@ mpi@ visa@
-rw-r--r-- | sys/kern/sys_socket.c | 6 | ||||
-rw-r--r-- | sys/kern/vfs_vnops.c | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 55ec42ea8d0..9078002abbc 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_socket.c,v 1.44 2020/01/08 16:27:41 visa Exp $ */ +/* $OpenBSD: sys_socket.c,v 1.45 2020/02/22 11:58:29 anton Exp $ */ /* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */ /* @@ -134,13 +134,17 @@ soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p) * different entry since a socket's unnecessary */ if (IOCGROUP(cmd) == 'i') { + KERNEL_LOCK(); error = ifioctl(so, cmd, data, p); + KERNEL_UNLOCK(); return (error); } if (IOCGROUP(cmd) == 'r') return (EOPNOTSUPP); + KERNEL_LOCK(); error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL, (struct mbuf *)cmd, (struct mbuf *)data, NULL, p)); + KERNEL_UNLOCK(); break; } diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index f175bbc7284..54fbebb00d8 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.112 2020/02/16 19:34:59 anton Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.113 2020/02/22 11:58:29 anton Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -510,6 +510,7 @@ vn_ioctl(struct file *fp, u_long com, caddr_t data, struct proc *p) struct vattr vattr; int error = ENOTTY; + KERNEL_LOCK(); switch (vp->v_type) { case VREG: @@ -541,6 +542,7 @@ vn_ioctl(struct file *fp, u_long com, caddr_t data, struct proc *p) default: break; } + KERNEL_UNLOCK(); return (error); } |