Source-Changes-HG archive

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

[src/trunk]: src/sys/dev sequencer(4): VOP_CLOSE requires vnode lock.



details:   https://anonhg.NetBSD.org/src/rev/469d6032a135
branches:  trunk
changeset: 365250:469d6032a135
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Apr 16 11:13:10 2022 +0000

description:
sequencer(4): VOP_CLOSE requires vnode lock.

Reported-by: syzbot+877c50d819fea9403247%syzkaller.appspotmail.com@localhost

diffstat:

 sys/dev/sequencer.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 7bbc38e61b85 -r 469d6032a135 sys/dev/sequencer.c
--- a/sys/dev/sequencer.c       Sat Apr 16 11:13:01 2022 +0000
+++ b/sys/dev/sequencer.c       Sat Apr 16 11:13:10 2022 +0000
@@ -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 @@
        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;
        }



Home | Main Index | Thread Index | Old Index