diff options
author | Renato Botelho <renato@netgate.com> | 2015-10-21 16:04:13 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-10-21 16:04:13 -0200 |
commit | 6dfdfbb12b356dae762c3bce132809457ed60d97 (patch) | |
tree | 4e87edfd6f7353e79d923ab457270e9351daec3d /sys/geom/geom_dev.c | |
parent | 13010d6b0da4d97e56243edbea0a585b8285cd3e (diff) | |
parent | d621159ed6a7d1c98cf81f17e313dffc64bf7c4f (diff) | |
download | FreeBSD-src-6dfdfbb12b356dae762c3bce132809457ed60d97.zip FreeBSD-src-6dfdfbb12b356dae762c3bce132809457ed60d97.tar.gz |
Merge branch 'stable/10' into devel
Diffstat (limited to 'sys/geom/geom_dev.c')
-rw-r--r-- | sys/geom/geom_dev.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index 621a037..1123323 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -356,6 +356,13 @@ g_dev_open(struct cdev *dev, int flags, int fmt, struct thread *td) #else e = 0; #endif + + /* + * This happens on attempt to open a device node with O_EXEC. + */ + if (r + w + e == 0) + return (EINVAL); + if (w) { /* * When running in very secure mode, do not allow @@ -399,6 +406,20 @@ g_dev_close(struct cdev *dev, int flags, int fmt, struct thread *td) #else e = 0; #endif + + /* + * The vgonel(9) - caused by eg. forced unmount of devfs - calls + * VOP_CLOSE(9) on devfs vnode without any FREAD or FWRITE flags, + * which would result in zero deltas, which in turn would cause + * panic in g_access(9). + * + * Note that we cannot zero the counters (ie. do "r = cp->acr" + * etc) instead, because the consumer might be opened in another + * devfs instance. + */ + if (r + w + e == 0) + return (EINVAL); + sc = cp->private; mtx_lock(&sc->sc_mtx); sc->sc_open += r + w + e; |