From patchwork Mon Jan 20 17:05:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 11342633 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 06E74139A for ; Mon, 20 Jan 2020 17:09:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E341022314 for ; Mon, 20 Jan 2020 17:09:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E341022314 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B5E516EA32; Mon, 20 Jan 2020 17:09:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 477206EA1B for ; Mon, 20 Jan 2020 17:06:16 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 9F2C02912D9 From: Ezequiel Garcia To: Greg Kroah-Hartman , "Rafael J . Wysocki" , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , David Airlie , Daniel Vetter Subject: [PATCH 0/5] drm/rockchip: Fix unbind/bind Date: Mon, 20 Jan 2020 14:05:57 -0300 Message-Id: <20200120170602.3832-1-ezequiel@collabora.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 20 Jan 2020 17:09:27 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, kernel@collabora.com, Ezequiel Garcia , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This series is an attempt to fix the unbind/bind crash (due to an use-after-free bug) found on rockchip-drm driver. The problem lies in the way the driver uses the component API. Currently, rockchip_drm_unbind calls component_unbind_all before drm_mode_config_cleanup, the former releasing the memory where the DRM objects are embedded. The series goal is basically to fix all the components, making proper use of the respective .destroy hooks, making sure there are no use-after-free or double-free issues. The first patch is likely the most controversial, which is required because component_bind_all will call component_unbind without calling drm_mode_config_cleanup, if any component fails to bind. As mentioned above, this is problematic in the DRM framework. Thanks! Ezequiel Ezequiel Garcia (5): component: Add an API to cleanup before unbind drm/rockchip: Fix the device unbind order drm/rockchip: vop: Fix CRTC unbind drm/rockchip: lvds: Fix component unbind drm/rockchip: rk3066_hdmi: Cleanup component unbind drivers/base/component.c | 9 +++- drivers/gpu/drm/rockchip/rk3066_hdmi.c | 8 +-- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 20 +++++--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 56 ++++++++------------- drivers/gpu/drm/rockchip/rockchip_lvds.c | 20 ++++---- include/linux/component.h | 10 +++- 6 files changed, 60 insertions(+), 63 deletions(-)