Module Name: src Committed By: riastradh Date: Tue May 9 12:03:55 UTC 2023
Modified Files: src/sys/dev/dkwedge: dk.c Log Message: 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+e46f31fe56e04f567...@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=8a00fd7f2e7459748d7a274098180a4708ff0f61 Fixes assertion sc->sc_dk.dk_openmask == 0. To generate a diff of this commit: cvs rdiff -u -r1.152 -r1.153 src/sys/dev/dkwedge/dk.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/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.152 src/sys/dev/dkwedge/dk.c:1.153 --- src/sys/dev/dkwedge/dk.c:1.152 Sat Apr 29 13:00:17 2023 +++ src/sys/dev/dkwedge/dk.c Tue May 9 12:03:55 2023 @@ -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, s 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);