Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/miscfs/specfs specfs: Assert opencnt is nonzero before d...
details: https://anonhg.NetBSD.org/src/rev/286f4fe04b28
branches: trunk
changeset: 364518:286f4fe04b28
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Mar 28 12:37:35 2022 +0000
description:
specfs: Assert opencnt is nonzero before decrementing.
diffstat:
sys/miscfs/specfs/spec_vnops.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (36 lines):
diff -r b6192e1cdfd8 -r 286f4fe04b28 sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c Mon Mar 28 12:37:26 2022 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c Mon Mar 28 12:37:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spec_vnops.c,v 1.206 2022/03/28 12:37:26 riastradh Exp $ */
+/* $NetBSD: spec_vnops.c,v 1.207 2022/03/28 12:37:35 riastradh Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.206 2022/03/28 12:37:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.207 2022/03/28 12:37:35 riastradh Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -944,6 +944,8 @@
KASSERT(sn->sn_opencnt == 1);
needclose = true;
} else {
+ KASSERT(sd->sd_opencnt);
+ KASSERT(sn->sn_opencnt);
sd->sd_opencnt--;
sn->sn_opencnt--;
if (vp->v_type == VBLK)
@@ -1643,6 +1645,8 @@
* between open and close can use fd_clone.
*/
mutex_enter(&device_lock);
+ KASSERT(sn->sn_opencnt);
+ KASSERT(sd->sd_opencnt);
sn->sn_opencnt--;
count = --sd->sd_opencnt;
if (vp->v_type == VBLK) {
Home |
Main Index |
Thread Index |
Old Index