diff options
author | 2010-09-23 18:49:39 +0000 | |
---|---|---|
committer | 2010-09-23 18:49:39 +0000 | |
commit | 717ea6e5ea5eb187c9c6c022c0d3894bb7b3496c (patch) | |
tree | 682cbc7dea86ebf3d2fb14cca5e4dabd0b1b2099 /sys/dev/raidframe/rf_openbsdkintf.c | |
parent | In procfs_root(), while the vn_lock on a newly-allocated vnode can not (diff) | |
download | wireguard-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/dev/raidframe/rf_openbsdkintf.c')
-rw-r--r-- | sys/dev/raidframe/rf_openbsdkintf.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/raidframe/rf_openbsdkintf.c b/sys/dev/raidframe/rf_openbsdkintf.c index 992ae78364b..51a8bd787e3 100644 --- a/sys/dev/raidframe/rf_openbsdkintf.c +++ b/sys/dev/raidframe/rf_openbsdkintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rf_openbsdkintf.c,v 1.59 2010/09/22 01:18:57 matthew Exp $ */ +/* $OpenBSD: rf_openbsdkintf.c,v 1.60 2010/09/23 18:49:39 oga Exp $ */ /* $NetBSD: rf_netbsdkintf.c,v 1.109 2001/07/27 03:30:07 oster Exp $ */ /*- @@ -2720,7 +2720,7 @@ rf_find_raid_components(void) if (bdevvp(dev, &vp)) panic("RAID can't alloc vnode"); - error = VOP_OPEN(vp, FREAD, NOCRED, 0); + error = VOP_OPEN(vp, FREAD, NOCRED, curproc); if (error) { /* @@ -2733,7 +2733,7 @@ rf_find_raid_components(void) /* Ok, the disk exists. Go get the disklabel. */ error = VOP_IOCTL(vp, DIOCGDINFO, (caddr_t)&label, - FREAD, NOCRED, 0); + FREAD, NOCRED, curproc); if (error) { /* * XXX can't happen - open() would @@ -2747,7 +2747,7 @@ rf_find_raid_components(void) * We don't need this any more. We'll allocate it again * a little later if we really do... */ - VOP_CLOSE(vp, FREAD | FWRITE, NOCRED, 0); + VOP_CLOSE(vp, FREAD | FWRITE, NOCRED, curproc); vrele(vp); for (i=0; i < label.d_npartitions; i++) { @@ -2770,7 +2770,7 @@ rf_find_raid_components(void) if (bdevvp(dev, &vp)) panic("RAID can't alloc vnode"); - error = VOP_OPEN(vp, FREAD, NOCRED, 0); + error = VOP_OPEN(vp, FREAD, NOCRED, curproc); if (error) { /* Whatever... */ vput(vp); @@ -2825,7 +2825,7 @@ rf_find_raid_components(void) if (!good_one) { /* Cleanup. */ free(clabel, M_RAIDFRAME); - VOP_CLOSE(vp, FREAD | FWRITE, NOCRED, 0); + VOP_CLOSE(vp, FREAD | FWRITE, NOCRED, curproc); vrele(vp); } } @@ -3328,7 +3328,7 @@ rf_release_all_vps(RF_ConfigSet_t *cset) while(ac!=NULL) { /* Close the vp, and give it back. */ if (ac->vp) { - VOP_CLOSE(ac->vp, FREAD, NOCRED, 0); + VOP_CLOSE(ac->vp, FREAD, NOCRED, curproc); vrele(ac->vp); ac->vp = NULL; } |