drm_open doesn't lock before increasing dev->open_count

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

 



is this a problem? before trying to submit a solution I wanted to make sure with the experts

it seems open_count isn't locked and can cause problems

and if it is a problem, and needs to be solved, should locking be done or is it better implemented with the (as I understand standard) kref?


http://lxr.linux.no/linux+v2.6.37/drivers/gpu/drm/drm_fops.c#L121
int drm_open(struct inode *inode, struct file *filp)
{
..<no lock>..

        retcode = drm_open_helper(inode, filp, dev);
        if (!retcode) {
                atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
		if (!dev->open_count++)
			retcode = drm_setup(dev);
	}
..
}

int drm_release(struct inode *inode, struct file *filp)
{
..<global lock>..
	if (!--dev->open_count) {
                if (atomic_read(&dev->ioctl_count)) {
                        DRM_ERROR("Device busy: %d\n",
                                  atomic_read(&dev->ioctl_count));
                        retcode = -EBUSY;
                } else
                        retcode = drm_lastclose(dev);
        }
        mutex_unlock(&drm_global_mutex);
}
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux