summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_disk.c
diff options
context:
space:
mode:
authoroga <oga@openbsd.org>2010-09-23 18:49:39 +0000
committeroga <oga@openbsd.org>2010-09-23 18:49:39 +0000
commit717ea6e5ea5eb187c9c6c022c0d3894bb7b3496c (patch)
tree682cbc7dea86ebf3d2fb14cca5e4dabd0b1b2099 /sys/kern/subr_disk.c
parentIn procfs_root(), while the vn_lock on a newly-allocated vnode can not (diff)
downloadwireguard-openbsd-717ea6e5ea5eb187c9c6c022c0d3894bb7b3496c.tar.xz
wireguard-openbsd-717ea6e5ea5eb187c9c6c022c0d3894bb7b3496c.zip
The only sensible argument for VOP_* calls that take a struct proc pointer is
curproc. A bunch of callers were passing in 0 (not even NULL, 0) as this pointer, which was fine until the called vnode function tried to do something with it. Typically, this code was then copy/pasted to various parts of the tree. Accept the facts of life and switch all of these over to passing curproc for now until the argument can be removed. Discovered by stsp trying to create a softraid on top of a vnd, which crashed with a NULL deref in vndioctl. softraid bits tested by mikeb and jsing. raidframe bits tested by pea, matthieu and naddy. The rest tested by at least thib, jsing and myself. ok thib@, jsing@.
Diffstat (limited to 'sys/kern/subr_disk.c')
-rw-r--r--sys/kern/subr_disk.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index f6f47712473..b9a65b512f0 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_disk.c,v 1.110 2010/09/23 13:20:36 jsing Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.111 2010/09/23 18:49:39 oga Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
@@ -1337,7 +1337,7 @@ disk_readlabel(struct disklabel *dl, dev_t dev)
return (errbuf);
}
- error = VOP_IOCTL(vn, DIOCGDINFO, (caddr_t)dl, FREAD, NOCRED, 0);
+ error = VOP_IOCTL(vn, DIOCGDINFO, (caddr_t)dl, FREAD, NOCRED, curproc);
if (error) {
snprintf(errbuf, sizeof(errbuf),
"cannot read disk label, 0x%x/0x%x, error %d",
@@ -1345,7 +1345,7 @@ disk_readlabel(struct disklabel *dl, dev_t dev)
return (errbuf);
}
- error = VOP_CLOSE(vn, FREAD, NOCRED, 0);
+ error = VOP_CLOSE(vn, FREAD, NOCRED, curproc);
if (error) {
snprintf(errbuf, sizeof(errbuf),
"cannot close disk, 0x%x/0x%x, error %d",