Received: by 2002:ac8:71d8:0:b0:40f:fb00:664b with SMTP id i24csp207280qtp; Fri, 4 Aug 2023 08:36:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4l2sVAK5NcQocM8A7MD/eaY3lZ8txnn5NOTnkIzuuApQtYF/Atr94Ds6C0Z+yIuKiUWRu X-Received: by 2002:a17:906:2250:b0:994:3207:cde3 with SMTP id 16-20020a170906225000b009943207cde3mr1975547ejr.49.1691163367987; Fri, 04 Aug 2023 08:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691163367; cv=none; d=google.com; s=arc-20160816; b=lYHf2CRFsaB77DHoRG/EDAerGlmtvUQWy7oQ0yqEX91kaY3xS9B3trPYstxeBklHOf kYmc0e+DE60Kw4aasEWqEvVdW2vrzhykiMllccbzSJKX7xi1QDdRdnkWijtlZTpw4vGS GWI3jDrm+n6E4LTcsLg+4JsyUnxnT0QHjhMJvI7Kyksx9x8XCc7Kjp84NEJVPjCbuOd9 VJLdvuGkThzgZCRhlNCflrdhhjcWSUJj6kJHOysdUBo1gzkbE104IDRxO2X9Uc2e6rV4 P/7L8uWLIxLBZLoqbJAdO5LD5JFD+1on9JGrYLBcCyxIRKGoputi1b3GoCVs2gwvpcuh MEiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=7Db7nVkKQM+HbfdioUDR7YaAqzxBVXHHxqOvwLFEvBc=; fh=L3qVOdH1ujMmG08yOqLWUlN5KiVWxqyEZ73voLaWAws=; b=X76mWWqQS9mzLLJL70yKd+a6uehRwXpjCWUh2JFcIh0CR6aSzD0f9dyCMUAp6p0KJT MtngArK+wJkm0ogNqKYk9rJbuGdeN0YxHbFaKYAtYf2ggUnKq3jeJcAayH9z8AYpzEdT WaM4umfrd8LFIVGh9qNv59Dd1XtaPBatE7PGPSYDfs2/E41gxBczFopp84u246jCGU5Y qjYtwysk/2YvJdfNgNaeqbWyrkyrsrtacnS6s5fi8vcZVfDiWEpA49Ow88i/CC8mfT+F Dt7auDfcpTynmVVou4hIWtgrk+XzocPdYnUJ4kDjdOFg0snMXRDEU1PKcrZp68rzQr9/ lV4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jf8zI10O; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g23-20020a1709061c9700b00988a0d78152si1847355ejh.55.2023.08.04.08.35.39; Fri, 04 Aug 2023 08:36:07 -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 header.i=@kernel.org header.s=k20201202 header.b=jf8zI10O; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229816AbjHDPJQ (ORCPT + 99 others); Fri, 4 Aug 2023 11:09:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229738AbjHDPJO (ORCPT ); Fri, 4 Aug 2023 11:09:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D91895247 for ; Fri, 4 Aug 2023 08:08:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 27BBA62063 for ; Fri, 4 Aug 2023 15:07:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C7B2C433CB for ; Fri, 4 Aug 2023 15:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691161637; bh=w545Z+d9TiXeg8V59l+wEz1UXwdM7KzVmVGqDmBSgu8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jf8zI10ODNKOXDods6xTXrfk3BmH077KaEN42Yj1Q6+waPX8RAhCMNm/+dTBVqhUV duqdkjFUrLvuo+NwChgtmlvQFT0dy2RcoVEXj198ZSveNO2BbaMGeXhRYZCf0koDFf y/gSfHTMK9Pu6fFu4JJOzyYJiWju+YlqeK4IAo60EVf/lOwamOJQlsOLn38rwiKH9M yWAkVOzr8qRA0uwtONWrk0RdXL6Z3eXNZp9bw7vmxqgA70WgWV11a8nsADt39eUW/f i/h27bblAo9YWi4F245h1UTGvv6wakuA8nrvg8YUJSaJPVRoqVM0n24MRJhvZ2trJJ iOqD7u1eQwbPA== Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-686e0213c0bso1680908b3a.1 for ; Fri, 04 Aug 2023 08:07:17 -0700 (PDT) X-Gm-Message-State: AOJu0YyKg6XPwORuAxrkU09DclYc38l0e1O3RSjtf9Ds4fzCDLR3nlyI x1Z7ptjNZCiiETAWUH3adnoyBoMs70RnoVwoLRqhJQ== X-Received: by 2002:a17:90a:3b0a:b0:268:4314:2dc6 with SMTP id d10-20020a17090a3b0a00b0026843142dc6mr1705121pjc.37.1691161637007; Fri, 04 Aug 2023 08:07:17 -0700 (PDT) MIME-Version: 1.0 References: <20230804-lt8912b-v1-0-c542692c6a2f@ideasonboard.com> <20230804-lt8912b-v1-2-c542692c6a2f@ideasonboard.com> In-Reply-To: <20230804-lt8912b-v1-2-c542692c6a2f@ideasonboard.com> From: Robert Foss Date: Fri, 4 Aug 2023 17:07:06 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/4] drm/bridge: lt8912b: Fix crash on bridge detach To: Tomi Valkeinen Cc: Adrien Grassein , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Francesco Dolcini , Stefan Eichenberger , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 On Fri, Aug 4, 2023 at 12:48=E2=80=AFPM Tomi Valkeinen wrote: > > 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 00000= 00000000000 > Mem abort info: > ESR =3D 0x0000000096000006 > EC =3D 0x25: DABT (current EL), IL =3D 32 bits > SET =3D 0, FnV =3D 0 > EA =3D 0, S1PTW =3D 0 > FSC =3D 0x06: level 2 translation fault > Data abort info: > ISV =3D 0, ISS =3D 0x00000006, ISS2 =3D 0x00000000 > CM =3D 0, WnR =3D 0, TnD =3D 0, TagAccess =3D 0 > GCS =3D 0, Overlay =3D 0, DirtyBit =3D 0, Xs =3D 0 > user pgtable: 4k pages, 48-bit VAs, pgdp=3D00000000858f3000 > [0000000000000000] pgd=3D0800000085918003, p4d=3D0800000085918003, pud=3D= 0800000085431003, pmd=3D0000000000000000 > Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP > Modules linked in: tidss(-) display_connector lontium_lt8912b tc358768 pa= nel_lvds panel_simple drm_dma_helper drm_kms_helper drm drm_panel_orientati= on_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=3D--) > 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 > --- > 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/b= ridge/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 *b= ridge) > > 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 > > -- > 2.34.1 > Reviewed-by: Robert Foss