From patchwork Fri Aug 4 10:48:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 131126 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:44a:b0:3f2:4152:657d with SMTP id ez10csp203882vqb; Fri, 4 Aug 2023 04:51:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGo59Zn8YKHPkhO4NoQxMWvYSpNuBbjbkfJPs6rkfnVgXf3Qvu10utch2oB2NDkgxAcdqjn X-Received: by 2002:a17:906:31c1:b0:99b:c0f0:77fe with SMTP id f1-20020a17090631c100b0099bc0f077femr1389734ejf.69.1691149914735; Fri, 04 Aug 2023 04:51:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691149914; cv=none; d=google.com; s=arc-20160816; b=a/7Ihc+tahjlvg2GY2zZ4ioxOY07+7zXU91XnWALMltlGcfnhBQWp9n/5mBgaOQ7pI 6sJmaAWawNRYk7avitdM7y9DdPD1NXnMuh9KmP27u8wro6yDJH3ZTpzpuBU9z6+sQR13 RlQhwkmXe4EMhekm9yYfjMktG0IlReiWRocRnH/l4LRSJXt45QZ0uxkYmG4Gz8U1+OSR UkgOgfQ58+ldHWY50siylK/wVKrfseU9NNupge6/v4vJcXROX+HSWhLJMfevUnxExqmG GnNGX5YXyPmzsZmIHxG99l89Iq+/SiMfp+IQDjva5N8j/R+5kGwszSp95xOwuEw+idJ+ 03fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=ZveWg3Y/3CMdHPNZKonD9oUFiBAEoMbBoOobt1FMe+o=; fh=ZOGtXHfkWMH/uI/XcDfhJQNKxcvOVtHiIbcBRd7ipUs=; b=o1zuCHiI5oDwktBGxudJCDkFf24A/uKNBJ/XAE4ufb7A7q3Wis1QLmbu97wWJY5CGB dKaVcB9Vm+iDzPfSDmtm0uyD4oDcvTsK+uj3Ry6PkXL3eOs+RrxGtTxivf0KUXtx8nSY Q+f5sQqI3IcYhXBqjcMFlMWh8kMzk5lCYvA01XAOosA/AUAW61CAXmrzqYBxQYUd1rpL KBFRWGX3UeOMX7fUFAlgL1mys94eb4QRVmbt2vY92AZKxaDBM5kzLillRF8d20N6Ojab K6ORv5eo6sceubhhCxqURZFIZz6P37wz6PgSkPXUGMJ7GidLiXhKfOja5xwZNM3WoSOz Dn0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=vqtielVZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mh22-20020a170906eb9600b00988c81e980dsi1482384ejb.1039.2023.08.04.04.51.30; Fri, 04 Aug 2023 04:51:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=vqtielVZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230012AbjHDKvG (ORCPT + 99 others); Fri, 4 Aug 2023 06:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbjHDKug (ORCPT ); Fri, 4 Aug 2023 06:50:36 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E98149E8 for ; Fri, 4 Aug 2023 03:48:36 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4F8E5188E; Fri, 4 Aug 2023 12:47:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1691146046; bh=sSHNiN7SCW+dnAbLNBvXVtT0IFfFTc4U7kIWW6bzkcc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=vqtielVZGZwDmNlYBA7mcOvKFUJXxaKDwV9ENxPhnF7RkoKUj+iyBdL5epoZglLE5 +VNMHB42QVM9YKyJhhogRZUWv63tw6wPo7fco2C2XFQ3G4Jn40mEUIz+J2IjEWB99Y H54EXzNb9GqIoivaraSX9uuHRfe0V6QhusyJ5mNM= From: Tomi Valkeinen Date: Fri, 04 Aug 2023 13:48:11 +0300 Subject: [PATCH 2/4] drm/bridge: lt8912b: Fix crash on bridge detach MIME-Version: 1.0 Message-Id: <20230804-lt8912b-v1-2-c542692c6a2f@ideasonboard.com> References: <20230804-lt8912b-v1-0-c542692c6a2f@ideasonboard.com> In-Reply-To: <20230804-lt8912b-v1-0-c542692c6a2f@ideasonboard.com> To: Adrien Grassein , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Francesco Dolcini , Stefan Eichenberger Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4076; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=sSHNiN7SCW+dnAbLNBvXVtT0IFfFTc4U7kIWW6bzkcc=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkzNd6zGvgxDYCLtrRiFJnpm3hEXSfsh2F+jd0H xfGLVuAJTOJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMzXegAKCRD6PaqMvJYe 9SAnD/42zhCeSiHSaQ04HYuQVR134RabhRuzmMjSbljYZOMS0jIIWPwPNPHxxU3+zAyYYaGj4Mn yhWybHz/BkupsiT4/o9+2zEtmN+bNf6dULlsP82Vdv3jX+2XBl2HWcecUVlpnI+3e4xIWmK1Tbp +2oMqm3Lxui0ryU6rpjnBbm3SxbmLMeE4/kPv13kZjO9SUpoU6afzUirve+LHO8O9Y/1rfsDqvs 0atCeMQAVmB/vcZMHmM8zQZQy3YILkB03M8PpWqEcNN2F24uM5GAmsyMqmQkFOaWtK3QgxMBFSK r1PYEUj8HMFBQfqA6MxDCns/QPvjT8K+yn7mlaLRC4oZVhRVBZZFRe61GTiCu2nAUk7SrK8WR9T 8HLR1koGTidrYoFH+tzvkZZ1Sk3bLhMhc8ucRE60/SnrIhxLfVcYubrrENMzX4cHhSn3NWoxHr0 +7ar3UgmiJYBohwYEgKMPoVMlIrkdDllu/Aos7rKyJwQvbz7hvaR4W9U8tUldn0kjm5ZX5+FK+U ZQwFxMnIiQM4mijTpP94lTYnBg7OsUbz6p1kRmox0qHxX1rsAsVLSsOwbLwe1KSYrNxHEpkKjY5 I4+7dvcTqIQYSCQTzuQdx+jrGausSMLDE/e5bsXRKvJzrjxw4OCa8axVKXpNy14memcm/1I6QI6 aYnhriViYhLissg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773299213050631656 X-GMAIL-MSGID: 1773299213050631656 The lt8912b driver, in its bridge detach function, calls drm_connector_unregister() and drm_connector_cleanup(). drm_connector_unregister() should be called only for connectors explicitly registered with drm_connector_register(), which is not the case in lt8912b. The driver's drm_connector_funcs.destroy hook is set to drm_connector_cleanup(). Thus the driver should not call either drm_connector_unregister() nor drm_connector_cleanup() in its lt8912_bridge_detach(), as they cause a crash on bridge detach: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 Mem abort info: ESR = 0x0000000096000006 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x06: level 2 translation fault Data abort info: ISV = 0, ISS = 0x00000006, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 user pgtable: 4k pages, 48-bit VAs, pgdp=00000000858f3000 [0000000000000000] pgd=0800000085918003, p4d=0800000085918003, pud=0800000085431003, pmd=0000000000000000 Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP Modules linked in: tidss(-) display_connector lontium_lt8912b tc358768 panel_lvds panel_simple drm_dma_helper drm_kms_helper drm drm_panel_orientation_quirks CPU: 3 PID: 462 Comm: rmmod Tainted: G W 6.5.0-rc2+ #2 Hardware name: Toradex Verdin AM62 on Verdin Development Board (DT) pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : drm_connector_cleanup+0x78/0x2d4 [drm] lr : lt8912_bridge_detach+0x54/0x6c [lontium_lt8912b] sp : ffff800082ed3a90 x29: ffff800082ed3a90 x28: ffff0000040c1940 x27: 0000000000000000 x26: 0000000000000000 x25: dead000000000122 x24: dead000000000122 x23: dead000000000100 x22: ffff000003fb6388 x21: 0000000000000000 x20: 0000000000000000 x19: ffff000003fb6260 x18: fffffffffffe56e8 x17: 0000000000000000 x16: 0010000000000000 x15: 0000000000000038 x14: 0000000000000000 x13: ffff800081914b48 x12: 000000000000040e x11: 000000000000015a x10: ffff80008196ebb8 x9 : ffff800081914b48 x8 : 00000000ffffefff x7 : ffff0000040c1940 x6 : ffff80007aa649d0 x5 : 0000000000000000 x4 : 0000000000000001 x3 : ffff80008159e008 x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000 Call trace: drm_connector_cleanup+0x78/0x2d4 [drm] lt8912_bridge_detach+0x54/0x6c [lontium_lt8912b] drm_bridge_detach+0x44/0x84 [drm] drm_encoder_cleanup+0x40/0xb8 [drm] drmm_encoder_alloc_release+0x1c/0x30 [drm] drm_managed_release+0xac/0x148 [drm] drm_dev_put.part.0+0x88/0xb8 [drm] devm_drm_dev_init_release+0x14/0x24 [drm] devm_action_release+0x14/0x20 release_nodes+0x5c/0x90 devres_release_all+0x8c/0xe0 device_unbind_cleanup+0x18/0x68 device_release_driver_internal+0x208/0x23c driver_detach+0x4c/0x94 bus_remove_driver+0x70/0xf4 driver_unregister+0x30/0x60 platform_driver_unregister+0x14/0x20 tidss_platform_driver_exit+0x18/0xb2c [tidss] __arm64_sys_delete_module+0x1a0/0x2b4 invoke_syscall+0x48/0x110 el0_svc_common.constprop.0+0x60/0x10c do_el0_svc_compat+0x1c/0x40 el0_svc_compat+0x40/0xac el0t_32_sync_handler+0xb0/0x138 el0t_32_sync+0x194/0x198 Code: 9104a276 f2fbd5b7 aa0203e1 91008af8 (f85c0420) Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge") Signed-off-by: Tomi Valkeinen Reviewed-by: Robert Foss --- drivers/gpu/drm/bridge/lontium-lt8912b.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c index 0e581f6e3c88..2d752e083433 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -589,9 +589,6 @@ static void lt8912_bridge_detach(struct drm_bridge *bridge) if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) drm_bridge_hpd_disable(lt->hdmi_port); - - drm_connector_unregister(<->connector); - drm_connector_cleanup(<->connector); } static enum drm_connector_status