https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273418

--- Comment #15 from Konstantin Belousov <k...@freebsd.org> ---
No, checking at list addition or removal is to late.
Problem is clearly that device is dereferenced while active, i.e. it sounds
as if somebody did dev_rel() manually.

So IMO the following assert is due, and it is indeed should be added to
the tree:

diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c
index c6efd0d421b1..f91e6e29b35d 100644
--- a/sys/fs/devfs/devfs_devs.c
+++ b/sys/fs/devfs/devfs_devs.c
@@ -175,6 +175,8 @@ devfs_free(struct cdev *cdev)
        struct cdev_priv *cdp;

        cdp = cdev2priv(cdev);
+       KASSERT((cdp->cdp_flags & CDP_ACTIVE) == 0,
+           ("cdev %p %s active and freed", cdp, cdev->si_name));
        if (cdev->si_cred != NULL)
                crfree(cdev->si_cred);
        devfs_free_cdp_inode(cdp->cdp_inode);

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to