Received: by 10.192.165.148 with SMTP id m20csp4002677imm; Tue, 8 May 2018 00:55:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqnjwEkCfanMtEYUtUkbUvnBGUuZRt0+OXY9lLKUhmrgeRnqUpGV1/hIL8+IdgVyWfx8oRZ X-Received: by 10.98.21.73 with SMTP id 70mr39254544pfv.91.1525766117817; Tue, 08 May 2018 00:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525766117; cv=none; d=google.com; s=arc-20160816; b=saHDfM8IUZDkJnK9/bKNFizzxe8PUz471twMH8aP6gU0hZCkvmVH8aHMqi7H6RgeSb xHezCCQ+o0RlnygPfOBeM3NIKeCYTP8Vj7JNqk1v8lPiak5J2GlqEL3+kXY88dp2zLJQ rwInqngg3hGumZxRoNpzth0VQYxKzXQmNB9Xm6Rab6IVPbg4dfCFlSFq0weetsqjcXVO 04qGDTzs7LAMW2YFE1ujdKJHLrcFGNBPaKFrSp1PnzX9AgSkqCed01Mml7F2ek1hI27x /L/YGzVsUasOzKpDcW5m8I0cuu3+ciS/QtdArD6vDLq+7hAPBr0x5eD4ocbgFFPO0E5i 3C6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=0UbOK7sj2B2kBjPecXG0cwJ7u7rECGtv47UelXmy18A=; b=U2kFnmRdkajUqRphQwco1vUnPNU5RTQDw+bhtHQPNE8/PXMvQyqpRfzJSGEtXBImV4 e1e9l4ZV+MtAM+L14Uf1OAEUpPNe7BlonneyQohFVRKUgUEb8MoMotEHDyQYrbi/MJSS EBI2bmwqyTWmQR5CqH/6e+aXabE5oCnFMgQc8Pm7tca4zbAwAU5xfJrsf9DP9VHPINEd Gx8VpzBeErNyphBR4Y1rAjfHbKHRQ2y+QxVXdGy/QFkQTgnp1mtr37CkxT+vMv/aYthI dkJx0xshCwDaX22NxuFW6HCEEW36jVJVpJJHnWNBRRk8zlYhgdO3RRYONstdSRN1mgKf bfGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=QPrxZ8Jh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b21-v6si19124073pgn.276.2018.05.08.00.55.03; Tue, 08 May 2018 00:55:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=QPrxZ8Jh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754345AbeEHHvp (ORCPT + 99 others); Tue, 8 May 2018 03:51:45 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:54054 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753987AbeEHHvn (ORCPT ); Tue, 8 May 2018 03:51:43 -0400 Received: by mail-wm0-f44.google.com with SMTP id a67so17113969wmf.3 for ; Tue, 08 May 2018 00:51:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=0UbOK7sj2B2kBjPecXG0cwJ7u7rECGtv47UelXmy18A=; b=QPrxZ8JhmVt+Y0tUWfvDVMRpPrexXe0NDX/LO83/vVh6l4rzZwEcHvF5AgYRswrMA4 AiPYhmXG2N7dkGzz5V/FQL7dBn9NELuMjwDZ/oxQ35bl6hr2oohXTNDPjaKqaKCY6wFv 3B9yYyPL+NiLJXjE704Q5mKce62k7f4WXCTOU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=0UbOK7sj2B2kBjPecXG0cwJ7u7rECGtv47UelXmy18A=; b=jZrvkueECWIC/HtmO61wrmxGF8D4mHyvAfrkReih56/FEvPFdc3iGoSsMcTxIe/oue C7FJIzJdncFCtaMjWhtmoe5k5INfNlpSbtCyjduZ7iNYh5QL5pyOCDgAXihiA0RmrdSG eurB9xNQpiML3TZ1hmY7537JubMd5jMCNyFxmYxz0Xb+yNQMJ/kJREJ6hAn1kAt57BtT RP7ldTzhKIjj5WwM35OjDo1CHqt6Qt+JKbvwXZDQi4nnfI292yd2zjQTSHnlU2KS7AXW dcpJ6MELE51CNBT41HdxNqKJ/23dPs375m5+7Gv/aWSnVHSsC7PH9Ebiq9/i9ALddiA+ FcSA== X-Gm-Message-State: ALQs6tCYSQ+EGuidazPrvuESVALI9azlGJuROg5KCBT1zTLBErCzkkW1 0mnEdDlyVlgA6fErSt3f+gOCqg== X-Received: by 2002:a50:c2c1:: with SMTP id u1-v6mr54383789edf.56.1525765902643; Tue, 08 May 2018 00:51:42 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:5635:0:39d2:f87e:2033:9f6]) by smtp.gmail.com with ESMTPSA id b47-v6sm14036572ede.70.2018.05.08.00.51.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 May 2018 00:51:41 -0700 (PDT) Date: Tue, 8 May 2018 09:51:39 +0200 From: Daniel Vetter To: Peter Rosin Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, David Airlie , Seung-Woo Kim , Krzysztof Kozlowski , linux-rockchip@lists.infradead.org, Kyungmin Park , Kukjin Kim , dri-devel@lists.freedesktop.org, Vincent Abriou , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/3] drm/sti: do not remove the drm_bridge that was never added Message-ID: <20180508075139.GM28661@phenom.ffwll.local> Mail-Followup-To: Peter Rosin , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, David Airlie , Seung-Woo Kim , Krzysztof Kozlowski , linux-rockchip@lists.infradead.org, Kyungmin Park , Kukjin Kim , dri-devel@lists.freedesktop.org, Vincent Abriou , linux-arm-kernel@lists.infradead.org References: <20180502074025.12421-1-peda@axentia.se> <20180502074025.12421-2-peda@axentia.se> <20180503090648.GG12521@phenom.ffwll.local> <20180507133929.GG12521@phenom.ffwll.local> <7f79c109-6b0f-000e-569b-1f702e0006d3@axentia.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7f79c109-6b0f-000e-569b-1f702e0006d3@axentia.se> X-Operating-System: Linux phenom 4.15.0-3-amd64 User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 07, 2018 at 04:24:43PM +0200, Peter Rosin wrote: > On 2018-05-07 15:59, Peter Rosin wrote: > > On 2018-05-07 15:39, Daniel Vetter wrote: > >> On Thu, May 03, 2018 at 11:12:21PM +0200, Peter Rosin wrote: > >>> On 2018-05-03 11:06, Daniel Vetter wrote: > >>>> On Wed, May 02, 2018 at 09:40:23AM +0200, Peter Rosin wrote: > >>>>> The more natural approach would perhaps be to add an drm_bridge_add, > >>>>> but there are several other bridges that never call drm_bridge_add. > >>>>> Just removing the drm_bridge_remove is the easier fix. > >>>>> > >>>>> Signed-off-by: Peter Rosin > >>>> > >>>> This mess is much bigger. There's 2 pairs of bridge functions: > >>>> > >>>> - drm_bridge_attach/detach. Those are meant to be called by the overall > >>>> drm driver to connect/disconnect a drm_bridge. > >>>> > >>>> - drm_bridge_add/remove. These are supposed to be called by the bridge > >>>> driver itself to register/unregister itself. Maybe we should rename > >>>> them, since the same issue happens with drm_panel, with the same > >>>> confusion. > >>>> > >>>> I thought someone was working on a cleanup series to fix this mess, but I > >>>> didn't find anything. > >>> > >>> Ok, I just spotted the imbalance and didn't really dig into what > >>> actually happens in these error paths. Now that I have done so I > >>> believe that the removed drm_bridge_remove calls causes NULL > >>> dereferences if/when the error paths are triggered. > >>> > >>> So, I don't think this can wait for some bigger cleanup. > >>> > >>> drm_bridge_remove calls list_del_init calls __list_del_entry calls > >>> __list_del with NULL in both prev and next since the list member > >>> is never initialized. prev and next are dereferenced by __list_del > >>> and you have *boom* > >>> > >>> I recommend adding the tag > >>> > >>> Fixes: 84601dbdea36 ("drm: sti: rework init sequence") > >>> > >>> so that stable picks this one up. > >> > >> I just wanted to correct your commit message text - the correct solution > >> is definitely _not_ for sti here to call drm_bridge_add. > > > > Ah, I see what you mean. Do you want me to respin? > > Hold on, no I don't agree. sti_hda.c does create a bridge for it's own > internal use. It does not drm_bridge_add it, because all that ever does > is adding the bridge to the global lost of bridges. But since this is > a bridge for internal use, there is little point in calling drm_bridge_add, > the driver currently gains nothing by doing so. > > But, drm_bridge_add might be a good place to put common stuff for every > bridge in the system, so it might be worthwhile to start requiring all > bridges to be drm_bridge_add-ed. And IMHO, it would not be wrong to have > the sti-hda driver call drm_bridge_add on the bridge it creates. > > Do you really think it is actively wrong to call drm_bridge_add for > internal bridges such as this? If we want to share bridge init code, then I think we need a drm_bridge_init(). Not overload drm_bridge_add (which really should be drm_bridge_register I think, but oh well, it's at least consistent with drm_panel_add). -Daniel > > Cheers, > Peter > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch