drm: Fix dev->ioctl_count references leak

This fixes the following error:
kernel: error: [drm:pid1167:drm_release] *ERROR* Device busy: 2

Because of that, drm_lastclose() was not called, leading to a few memory
leaks once the driver was unloaded.

MFC after:	1 week
This commit is contained in:
Jean-Sébastien Pédron 2016-03-11 18:59:15 +00:00
parent b8eb229d6f
commit 85cfd0daea

View File

@ -386,17 +386,21 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
switch (cmd) {
case FIONBIO:
case FIOASYNC:
atomic_dec(&dev->ioctl_count);
return 0;
case FIOSETOWN:
atomic_dec(&dev->ioctl_count);
return fsetown(*(int *)data, &file_priv->minor->buf_sigio);
case FIOGETOWN:
atomic_dec(&dev->ioctl_count);
*(int *) data = fgetown(&file_priv->minor->buf_sigio);
return 0;
}
if (IOCGROUP(cmd) != DRM_IOCTL_BASE) {
atomic_dec(&dev->ioctl_count);
DRM_DEBUG("Bad ioctl group 0x%x\n", (int)IOCGROUP(cmd));
return EINVAL;
}