NetBSD-Syzbot archive

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

assert failed: sc->sc_dk.dk_openmask == NUM



#syz test: https://github.com/NetBSD/src trunk

https://syzkaller.appspot.com/bug?id=8a00fd7f2e7459748d7a274098180a4708ff0f61

-- 
You received this message because you are subscribed to the Google Groups "syzkaller-netbsd-bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-netbsd-bugs+unsubscribe%googlegroups.com@localhost.
To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-netbsd-bugs/20230509110408.AE478608C5%40jupiter.mumble.net.
diff --git a/sys/dev/dkwedge/dk.c b/sys/dev/dkwedge/dk.c
index 7cd825b9691d..42a47704a1f4 100644
--- a/sys/dev/dkwedge/dk.c
+++ b/sys/dev/dkwedge/dk.c
@@ -755,14 +755,27 @@ dkwedge_detach(device_t self, int flags)
 /*
  * dkwedge_delall:	[exported function]
  *
- *	Delete all of the wedges on the specified disk.  Used when
- *	a disk is being detached.
+ *	Forcibly delete all of the wedges on the specified disk.  Used
+ *	when a disk is being detached.
  */
 void
 dkwedge_delall(struct disk *pdk)
 {
 
-	dkwedge_delall1(pdk, false);
+	dkwedge_delall1(pdk, /*idleonly*/false);
+}
+
+/*
+ * dkwedge_delidle:	[exported function]
+ *
+ *	Delete all of the wedges on the specified disk if idle.  Used
+ *	by ioctl(DIOCRMWEDGES).
+ */
+void
+dkwedge_delidle(struct disk *pdk)
+{
+
+	dkwedge_delall1(pdk, /*idleonly*/true);
 }
 
 static void
@@ -1088,7 +1101,7 @@ dkwedge_discover(struct disk *pdk)
 	/*
 	 * Remove unused wedges
 	 */
-	dkwedge_delall1(pdk, true);
+	dkwedge_delidle(pdk);
 
 	/*
 	 * For each supported partition map type, look to see if
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index 406bb69a6794..7da4729dbeb8 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -655,7 +655,7 @@ disk_ioctl(struct disk *dk, dev_t dev, u_long cmd, void *data, int flag,
 		if ((flag & FWRITE) == 0)
 			return EBADF;
 
-		dkwedge_delall(dk);
+		dkwedge_delidle(dk);
 		return 0;
 
 	default:
diff --git a/sys/sys/disk.h b/sys/sys/disk.h
index 5b45a77cd244..ddee47e1737c 100644
--- a/sys/sys/disk.h
+++ b/sys/sys/disk.h
@@ -552,6 +552,7 @@ void	dkwedge_init(void);
 int	dkwedge_add(struct dkwedge_info *);
 int	dkwedge_del(struct dkwedge_info *);
 void	dkwedge_delall(struct disk *);
+void	dkwedge_delidle(struct disk *);
 int	dkwedge_list(struct disk *, struct dkwedge_list *, struct lwp *);
 void	dkwedge_discover(struct disk *);
 int	dkwedge_read(struct disk *, struct vnode *, daddr_t, void *, size_t);


Home | Main Index | Thread Index | Old Index