Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Mar 2007 08:53:47 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-current@freebsd.org
Subject:   Panic in devfs
Message-ID:  <200703290853.47940.hselasky@c2i.net>

next in thread | raw e-mail | index | archive | help
Hi,

I initially forwarded this to PHK, but got no reply so I'm posting it here.

I have caught a panic related to devfs while working on the new USB stack. 
Backtrace:

uma_zalloc_arg()
malloc()
free_unr()
devfs_free()
destroy_devl()
destroy_dev()
ttyfree()
...
...

The problem is that the lock, "devmtx", see "kern_conf.c" line 61, is locked 
when allocating memory. Maybe you have to call this "free_unr()" out of 
order?

void
devfs_free(struct cdev *cdev)
{
        struct cdev_priv *cdp;

        cdp = cdev->si_priv;
        if (cdev->si_cred != NULL)
                crfree(cdev->si_cred);
        if (cdp->cdp_inode > 0)
                free_unr(devfs_inos, cdp->cdp_inode); XXX cannot call this 
here because this function allocates memory XXX
        if (cdp->cdp_maxdirent > 0) 
                free(cdp->cdp_dirents, M_DEVFS2);
        free(cdp, M_CDEVP);
}

Can someone fix this and commit a patch to head, or should I make a PR out of 
this?

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703290853.47940.hselasky>