[PATCH 10/11] modesetting: Fix mmap leak in scanout_pixmap_cpu

Alex Goins agoins at nvidia.com
Wed Nov 25 18:39:34 PST 2015


drmmode_set_scanout_pixmap_cpu() uses drmmode_map_slave_bo(), which maps a
dumb bo. However, when cleaning up scanout pixmaps, it never destroys it,
leading to a leak of mapped memory. With enough modesets, this can result
in an insane amount of memory being mapped. Add dumb_bo_destroy() of the
backing bo as part of the cleanup process.

Signed-off-by: Alex Goins <agoins at nvidia.com>
---
 hw/xfree86/drivers/modesetting/drmmode_display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 64d5e4e..9c85b75 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -778,12 +778,14 @@ drmmode_set_scanout_pixmap_cpu(xf86CrtcPtr crtc, PixmapPtr ppix)
         if (crtc->randr_crtc->scanout_pixmap) {
             ppriv = msGetPixmapPriv(drmmode, crtc->randr_crtc->scanout_pixmap);
             drmModeRmFB(drmmode->fd, ppriv->fb_id);
+            dumb_bo_destroy(drmmode->fd, ppriv->backing_bo);
 
             if (crtc->randr_crtc->scanout_pixmap_back) {
                 drmmode_FiniSharedPixmapFlipping(crtc, drmmode);
                 ppriv = msGetPixmapPriv(drmmode,
                                         crtc->randr_crtc->scanout_pixmap_back);
                 drmModeRmFB(drmmode->fd, ppriv->fb_id);
+                dumb_bo_destroy(drmmode->fd, ppriv->backing_bo);
             }
         }
         if (drmmode_crtc->slave_damage) {
-- 
1.9.1



More information about the xorg-devel mailing list