From: deraadt Date: Sun, 21 Nov 2021 23:07:11 +0000 (+0000) Subject: correct the vnd-on-vnd dev_t test, and avoid leaking a cred in an X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c9989a63e9e08ce5601f18723d41620630c38f71;p=openbsd correct the vnd-on-vnd dev_t test, and avoid leaking a cred in an obscure condition ok tb --- diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index 94b0da08743..9b7b2cec5ca 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnd.c,v 1.173 2021/11/18 16:57:59 tb Exp $ */ +/* $OpenBSD: vnd.c,v 1.174 2021/11/21 23:07:11 deraadt Exp $ */ /* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */ /* @@ -473,7 +473,7 @@ fail: } /* Cannot put a vnd on top of a vnd */ - if (major(vattr.va_rdev) == major(dev)) { + if (major(vattr.va_fsid) == major(dev)) { error = EINVAL; goto fail; } @@ -491,7 +491,7 @@ fail: if ((error = disk_lock(&sc->sc_dk)) != 0) { crfree(cred); - return (error); + goto fail; } /* Set geometry for device. */