Module Name: src
Committed By: ad
Date: Sat May 23 22:16:17 UTC 2020
Modified Files:
src/sys/kern: tty_ptm.c
Log Message:
PR kern/55237: Panic: vrelel: bad ref count (9.99.54)
Adjust v_writecount with v_interlock held.
To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/kern/tty_ptm.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/kern/tty_ptm.c
diff -u src/sys/kern/tty_ptm.c:1.41 src/sys/kern/tty_ptm.c:1.42
--- src/sys/kern/tty_ptm.c:1.41 Sat Nov 30 20:45:49 2019
+++ src/sys/kern/tty_ptm.c Sat May 23 22:16:17 2020
@@ -1,7 +1,7 @@
-/* $NetBSD: tty_ptm.c,v 1.41 2019/11/30 20:45:49 ad Exp $ */
+/* $NetBSD: tty_ptm.c,v 1.42 2020/05/23 22:16:17 ad Exp $ */
/*-
- * Copyright (c) 2004 The NetBSD Foundation, Inc.
+ * Copyright (c) 2004, 2020 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_ptm.c,v 1.41 2019/11/30 20:45:49 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_ptm.c,v 1.42 2020/05/23 22:16:17 ad Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -145,7 +145,9 @@ pty_vn_open(struct vnode *vp, struct lwp
return error;
}
+ mutex_enter(vp->v_interlock);
vp->v_writecount++;
+ mutex_exit(vp->v_interlock);
return 0;
}