Author: dumbbell
Date: Fri Mar 11 18:59:15 2016
New Revision: 296674
URL: https://svnweb.freebsd.org/changeset/base/296674

Log:
  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

Modified:
  head/sys/dev/drm2/drm_drv.c

Modified: head/sys/dev/drm2/drm_drv.c
==============================================================================
--- head/sys/dev/drm2/drm_drv.c Fri Mar 11 17:39:54 2016        (r296673)
+++ head/sys/dev/drm2/drm_drv.c Fri Mar 11 18:59:15 2016        (r296674)
@@ -386,17 +386,21 @@ int drm_ioctl(struct cdev *kdev, u_long 
        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;
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to