summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2013-10-16 05:23:17 +0000
committerRobert Mustacchi <rm@joyent.com>2013-11-06 11:36:21 -0800
commit368fc9412cc48af49761a1b8808d9c4079709391 (patch)
treea43e4e5746664f9fa280aae4cc90284afd2e7356
parent393cba3d826b7fd70b8ab083125c4b25c43ee482 (diff)
downloadillumos-joyent-368fc9412cc48af49761a1b8808d9c4079709391.tar.gz
4243 sdev_access() race leads to panic
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Approved by: Eric Schrock <eric.schrock@delphix.com>
-rw-r--r--usr/src/uts/common/fs/dev/sdev_vnops.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/usr/src/uts/common/fs/dev/sdev_vnops.c b/usr/src/uts/common/fs/dev/sdev_vnops.c
index 3b6fe5e79a..6570c967f4 100644
--- a/usr/src/uts/common/fs/dev/sdev_vnops.c
+++ b/usr/src/uts/common/fs/dev/sdev_vnops.c
@@ -578,17 +578,16 @@ sdev_access(struct vnode *vp, int mode, int flags, struct cred *cr,
struct sdev_node *dv = VTOSDEV(vp);
int ret = 0;
+ rw_enter(&dv->sdev_contents, RW_READER);
ASSERT(dv->sdev_attr || dv->sdev_attrvp);
-
if (dv->sdev_attrvp) {
ret = VOP_ACCESS(dv->sdev_attrvp, mode, flags, cr, ct);
} else if (dv->sdev_attr) {
- rw_enter(&dv->sdev_contents, RW_READER);
ret = sdev_unlocked_access(dv, mode, cr);
if (ret)
ret = EACCES;
- rw_exit(&dv->sdev_contents);
}
+ rw_exit(&dv->sdev_contents);
return (ret);
}