Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: panic: kernel diagnostic assertion VOP_ISLOCKET(vp) == LK_EXCLUSIVE



On Sat, 16 Apr 2022 16:51:31 +0200
Thomas Klausner <wiz%NetBSD.org@localhost> wrote:

> panic: kernel diagnostic assertion "VOP_ISLOCKED(vp) == LK_EXCLUSIVE" failed: file "/usr/src/sys/miscfs/specfs/spec_vnops.c", line 1555
> cpu1: Begin traceback...
> vpanic()
> kern_assert()
> spec_close() at netbsd:spec_close+0x2fc
> VOP_CLOE() at netbsd:vop_close+0x42
> sequenceropen() at netbsd:sequenceropen+0x359

"cat /dev/sequencer" as a regular user is enough to trigger this. In
the midiseq_open() error path it is trying to VOP_CLOSE without the
vnode lock held. Maybe this patch helps. (Someone with filesystem
clue please sanity check this.)

--- sys/dev/sequencer.c	31 Mar 2022 19:30:15 -0000	1.76
+++ sys/dev/sequencer.c	16 Apr 2022 15:23:54 -0000
@@ -1452,8 +1452,9 @@ midiseq_open(int unit, int flags)
 	if ((mi.props & MIDI_PROP_CAN_INPUT) == 0)
 	        flags &= ~FREAD;
 	if ((flags & (FREAD|FWRITE)) == 0) {
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 		VOP_CLOSE(vp, oflags, kauth_cred_get());
-		vrele(vp);
+		vput(vp);
 	        return NULL;
 	}


Home | Main Index | Thread Index | Old Index