Module Name:    src
Committed By:   riastradh
Date:           Sat Apr 16 11:13:10 UTC 2022

Modified Files:
        src/sys/dev: sequencer.c

Log Message:
sequencer(4): VOP_CLOSE requires vnode lock.

Reported-by: syzbot+877c50d819fea9403...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/sequencer.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sequencer.c
diff -u src/sys/dev/sequencer.c:1.78 src/sys/dev/sequencer.c:1.79
--- src/sys/dev/sequencer.c:1.78	Sat Apr 16 11:13:01 2022
+++ src/sys/dev/sequencer.c	Sat Apr 16 11:13:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sequencer.c,v 1.78 2022/04/16 11:13:01 riastradh Exp $	*/
+/*	$NetBSD: sequencer.c,v 1.79 2022/04/16 11:13:10 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.78 2022/04/16 11:13:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.79 2022/04/16 11:13:10 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "sequencer.h"
@@ -1466,7 +1466,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());
+		VOP_UNLOCK(vp);
 		vrele(vp);
 	        return NULL;
 	}

Reply via email to