summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranton <anton@openbsd.org>2019-08-05 08:46:46 +0000
committeranton <anton@openbsd.org>2019-08-05 08:46:46 +0000
commit3e253b4759f08d298fbb0e56aa73949eeffe1a63 (patch)
treea2cdd2aec898f18a2dee9346d25a82330688b3a3
parentChange the order how filtersets are passed during config reloads. Instead (diff)
downloadwireguard-openbsd-3e253b4759f08d298fbb0e56aa73949eeffe1a63.tar.xz
wireguard-openbsd-3e253b4759f08d298fbb0e56aa73949eeffe1a63.zip
Favor vn_close() in the error path of diskmapioctl() since side-effects
caused by calling vn_open() with write permissions must be reverted. Otherwise, the vfs subsystem could panic while releasing the last vnode reference if the writecount is still positive. ok visa@ Reported-by: syzbot+4724df09d9ab0fdca28a@syzkaller.appspotmail.com Reported-by: syzbot+a430606fd528645559db@syzkaller.appspotmail.com
-rw-r--r--sys/dev/diskmap.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sys/dev/diskmap.c b/sys/dev/diskmap.c
index 33a533f0a19..e035ee36466 100644
--- a/sys/dev/diskmap.c
+++ b/sys/dev/diskmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diskmap.c,v 1.24 2018/08/20 14:59:02 visa Exp $ */
+/* $OpenBSD: diskmap.c,v 1.25 2019/08/05 08:46:46 anton Exp $ */
/*
* Copyright (c) 2009, 2010 Joel Sing <jsing@openbsd.org>
@@ -135,9 +135,7 @@ diskmapioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
bad:
fdpunlock(fdp);
-
- if (vp)
- vrele(vp);
+ (void)vn_close(vp, fp0->f_flag, p->p_ucred, p);
invalid:
if (fp0)
FRELE(fp0, p);