On Tue, 17 Mar 2009 10:02:14 -0700, Dan Williams <dan.j.williams@xxxxxxxxx> wrote: > >> The sysfs device has a longer lifetime than dma_device. See commit > >> 41d5e59c [1]. > > > > The sysfs device for dma_chan (dma_chan_dev) has a shorter lifetime > > than dma_device, doesn't it? > > No, dma_async_device_unregister(), and the freeing of dma_device, may > finish before chan_dev_release is called. Userspace gates the final > release of dma_chan_dev objects. You mean, if the sysfs device file was opened when dma_async_device_unregister() was called, the sysfs device will not be released until the sysfs device file is closed, right? If so I can see. BTW, there are another holes in dma_async_device_register. If idr_pre_get or idr_get_new was failed, idr_ref will not be freed. --- Atsushi Nemoto