星期二 五月 23, 2006

mutex panic: bad mutex

The direct trigger could be: a mutex is reused after it's destroyed.  For example, see below code:

typedef struct drv{

    kmutex_t drv_lock;

    ...

} dtv_t;

static void

drv_unattach(drv_t *drvp)

{

    mutex_destroy(drvp->drv_lock);

    ...

    ddi_intr_remove_handler(...);

}



Above code remove interrupt handler after mutex_destroy. The problem is
after the mutex destroyed, there is still possibility for an interrupt
to come in. If the mutex is used in the interrupt context, the "bad
mutex" panic will happen.

评论:

发表一条评论:
  • HTML语法: 禁用