From patchwork Fri Jul 20 14:11:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damir Shaikhutdinov X-Patchwork-Id: 10539695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BFCDA157A for ; Mon, 23 Jul 2018 07:19:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A509B2852C for ; Mon, 23 Jul 2018 07:19:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9958328531; Mon, 23 Jul 2018 07:19:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D1D32852C for ; Mon, 23 Jul 2018 07:19:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 30E5C6E285; Mon, 23 Jul 2018 07:19:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 383706EFFB for ; Fri, 20 Jul 2018 14:11:53 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id t3-v6so9888510eds.3 for ; Fri, 20 Jul 2018 07:11:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=O12Fzoq/pgPaiFplBQ7x2ouS+2tIn2EtYVjtixWKuKA=; b=b0eZcXesh2eoXUFE82fE6r9Cqv5uFal2guBcRabEuzvyA8MJbiIFMwFVleDFGyr7eJ QxzI2JsJXui0SLyPXB2YVSMOuwYhLzzWFf3v0xFVMA50nQIunuYmbNiBxd7Gcmv4ujSb Z2koIPnjQmhXlpnv9xUKMpBjUG6Bvryq0E+/7427xLqs+k7FhyAMM4rteBWAUhkhaEOc ZHoTWjGn3u/Z6swxpl0z3I7hsbgHALYsBJZ03k9Y3oVvPD6ID9btvZlXBdmmGBh4NDix xfaekJk4IX0qIT+hZ0R5lWvq3JETFuEQ6ENFI3vfqRXoz+EUZdG2kduV4kUzgP1QXt9a 7yKQ== X-Gm-Message-State: AOUpUlE5E8l6o6s/EwCwv7AYf6LuR9QZjybrMO1GUYXywhYRKiIQ9XFa 7yOTSLMR/ODXNvZcAUrlh1A= X-Google-Smtp-Source: AAOMgpcyX5Ucrqt8/nTpLZQe7KXRTWVk6MFEGiE2vW4VVAcSiBzXEf7xB3WsL5PrSNM40ne8z/sOYA== X-Received: by 2002:a50:afc4:: with SMTP id h62-v6mr2778806edd.251.1532095911898; Fri, 20 Jul 2018 07:11:51 -0700 (PDT) Received: from os-lin-dsh.open-synergy.com ([217.66.60.5]) by smtp.gmail.com with ESMTPSA id j16-v6sm3391749edj.71.2018.07.20.07.11.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 07:11:51 -0700 (PDT) From: Damir Shaikhutdinov X-Google-Original-From: Damir Shaikhutdinov To: aerlied@gmail.com Subject: [PATCH 4/4] drm/virtio: Fix connector leak during virtio-gpu deinitialization. Date: Fri, 20 Jul 2018 16:11:43 +0200 Message-Id: <20180720141143.15469-5-damir.shaikhutdinov@opensynergy.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180720141143.15469-1-damir.shaikhutdinov@opensynergy.com> References: <20180720141143.15469-1-damir.shaikhutdinov@opensynergy.com> X-Mailman-Approved-At: Mon, 23 Jul 2018 07:18:41 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damir Shaikhutdinov , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Attaching CRTC to a connector increases its reference count, preventing it from correct deinitialization. Following kernel log is printed when the leak is found: Console: switching to colour VGA+ 80x25 WARNING: at drivers/gpu/drm/drm_mode_config.c:431 ... Call Trace: drm_mode_config_cleanup virtio_gpu_modeset_fini virtio_gpu_driver_unload drm_dev_unregister drm_put_dev virtio_gpu_remove virtio_dev_remove device_release_driver_internal device_release_driver bus_remove_device device_del device_unregister unregister_virtio_device ... [drm:drm_mode_config_cleanup] ERROR connector Virtual-1 leaked! Calling drm_atomic_helper_shutdown disconnects CRTCs from connectors, allowing them to be freed during drm_mode_config_cleanup. Signed-off-by: Damir Shaikhutdinov Signed-off-by: Kiran Pawar --- drivers/gpu/drm/virtio/virtgpu_display.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index d314e3c672f2..088a751a35e9 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -377,5 +377,6 @@ int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev) void virtio_gpu_modeset_fini(struct virtio_gpu_device *vgdev) { + drm_atomic_helper_shutdown(vgdev->ddev); drm_mode_config_cleanup(vgdev->ddev); }