Disk lock was held when returning to userland. Add a missing unlock
authorbluhm <bluhm@openbsd.org>
Thu, 23 Dec 2021 10:09:16 +0000 (10:09 +0000)
committerbluhm <bluhm@openbsd.org>
Thu, 23 Dec 2021 10:09:16 +0000 (10:09 +0000)
in vnd ioctl error path.
Reported-by: syzbot+6dde3fda33074a256318@syzkaller.appspotmail.com
OK jsg@ anton@

sys/dev/vnd.c

index 53c12b2..bbd124d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: vnd.c,v 1.176 2021/12/21 06:12:03 anton Exp $ */
+/*     $OpenBSD: vnd.c,v 1.177 2021/12/23 10:09:16 bluhm Exp $ */
 /*     $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $        */
 
 /*
@@ -498,6 +498,7 @@ fail:
                if ((error = disk_lock(&sc->sc_dk)) != 0)
                        goto fail;
                if (sc->sc_flags & VNF_INITED) {
+                       disk_unlock(&sc->sc_dk);
                        error = EBUSY;
                        goto fail;
                }