diff options
| author | riastradh <riastradh@NetBSD.org> | 2023-05-09 12:03:55 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2023-05-09 12:03:55 +0000 |
| commit | 86274b6ec76f3a5c49801f7d3eb2b0fc354dc053 (patch) | |
| tree | 73ccc79c1f630ec74bc0a2cd476a02d3454527c2 /sys/dev/dkwedge/dk.c | |
| parent | 37f8bc426b13c4a10bfd834635b2fef72275355e (diff) | |
dk(4): dkclose must handle a dying wedge too to close the parent.
Otherwise the parent open leaks on detach (or revoke) when the wedge
was open and had to be forcibly closed.
Reported-by: syzbot+e46f31fe56e04f567d88@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=8a00fd7f2e7459748d7a274098180a4708ff0f61
Fixes assertion sc->sc_dk.dk_openmask == 0.
Diffstat (limited to 'sys/dev/dkwedge/dk.c')
| -rw-r--r-- | sys/dev/dkwedge/dk.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/dkwedge/dk.c b/sys/dev/dkwedge/dk.c index e244eb6d1bc..cf9b2453208 100644 --- a/sys/dev/dkwedge/dk.c +++ b/sys/dev/dkwedge/dk.c @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.152 2023/04/29 13:00:17 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.153 2023/05/09 12:03:55 riastradh Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.152 2023/04/29 13:00:17 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.153 2023/05/09 12:03:55 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1385,7 +1385,8 @@ dkclose(dev_t dev, int flags, int fmt, struct lwp *l) if (sc == NULL) return ENXIO; - if (sc->sc_state != DKW_STATE_RUNNING) + if (sc->sc_state != DKW_STATE_RUNNING && + sc->sc_satte != DKW_STATE_DYING) return ENXIO; mutex_enter(&sc->sc_dk.dk_openlock); |
