Received: by 10.192.165.148 with SMTP id m20csp3099006imm; Mon, 7 May 2018 06:40:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrNvRx/GZUpvtySpTsQ3Zy6L6ThtsqclsqWilKcFPHMe/6BSmvRlsurf+LvaNdL2ryyqYUW X-Received: by 2002:a17:902:8f94:: with SMTP id z20-v6mr23925408plo.391.1525700440683; Mon, 07 May 2018 06:40:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525700440; cv=none; d=google.com; s=arc-20160816; b=q6B2iuYe/SDKUu3yzoL4rEtrhh1fib6KZ/0XB8cC9VX/RTsMleIfgEa84qIy/t3u+X ZuW73f6k5l/c5bV4xZWp2h972x+ItzXT1xBwDUYYgtMEPz0+uUOcTo3LQSLR+vuEhy++ eUewOAP89ipdwb4ZzUEuLnc86bwSmC+JaJXH0v/oyAHoV4O5AytCnvRsQxBGJi1LdvsY dtvV883gmoDdf3WbfD5eTH5dtBVNba4RBYCoTwzwN2JKJ2g6ormNCT1zxgW/xTVp3ELL 7NLMb0AJQ3ojHYaT9zHaC62VQ2SBhoZdmyzHAtnKFqMfM1bIpjKLuJoYGNehKypbXvwm 2nRQ== 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=YhE3Y2qS28iZQTan6ROg0gXxZ/NkNniwDkpfBW4Of3E=; b=j7/vQyigTDoerDDHC6GjZr5PdcJOzZb2iqstkrKcvcTI/CrIPI8/ZkgoABbFDYNLkm 5xalLoPDSgonEH9b4QxVyxQqC4XCoVw7aMHS8EhwmxfDQYvwBTNiKFEvIeVcnPyyJST9 wfg6qbQn1YFuZGALXxKEvhJqIPX8i1lK1lBzF5xOM0htr8m0fgdtnUjNgLn8z3SDZVfr V/sxR5UyhO73phgJybHQ6E1AVMCiLXW9zI9J75D2E8nt5SLaq6cmKpxzvHVvcJTgrRA2 XfoFsKEQTAuu8/WnklVqDDppQSw830b/xjDiOhWs3tgbJS0CMbOis7yn62NOwHvoxLpp 5vLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=fPyyPxX0; 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 k17si14708979pfj.310.2018.05.07.06.40.26; Mon, 07 May 2018 06:40:40 -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=fPyyPxX0; 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 S1752425AbeEGNjh (ORCPT + 99 others); Mon, 7 May 2018 09:39:37 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:52129 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751923AbeEGNje (ORCPT ); Mon, 7 May 2018 09:39:34 -0400 Received: by mail-wm0-f68.google.com with SMTP id j4so13490127wme.1 for ; Mon, 07 May 2018 06:39:33 -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=YhE3Y2qS28iZQTan6ROg0gXxZ/NkNniwDkpfBW4Of3E=; b=fPyyPxX0fkTExeY5yLRGlBeZKXhJkIcHDTkftoV9TzX6L7TMyhzGLjXSp/JU11EYTY 1vly0wfrsSlTZhGv4Dm1af76riKQEYGtwgoqlSoWCjx3fluv44wVqCFSn4Nt4zsBd1lZ woAHgLcfQW9TKHjRPNAvoSnVCzmrMS7I+Ng3c= 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=YhE3Y2qS28iZQTan6ROg0gXxZ/NkNniwDkpfBW4Of3E=; b=IwgBIRGDKwRT7vp+62kVfDoJOe7nSZnP92+vkY6mq4FB0k12iA5Mc8pn21zNMDPdjt +Vs30rDl+xTrfkUS7D0b1jhXCaYOL79Tk1xI0qnC/4KHUEwYYaTmxTQDOFD1ZVuMOplZ H8NeKEOjCPz+1Fmd30ZfZR3ZXHFwGW7egqd0+P9KdnTnmF5G/16uC1Zi1gVJgdFQ972o EAIq+Ri02TwCWk7zwhRcdYGn7XCpKEE+Ghuy2lc47JzwYmjJEVGSORomXf9nmcLFBtHw fT01hjIxdb7YTIaAYxp2KR5h44XP1yrWHUoU9DPeMEnSadt5JmEedtPhvQv4KntzbVAV LBAg== X-Gm-Message-State: ALQs6tAZXCI4UDwN6z7Psd7f2/pb0FXW9uU301iBhtpro+7z6ZUCDGSL ratwupMTI5sCXTHpscJF/o9mOw== X-Received: by 2002:a50:a365:: with SMTP id 92-v6mr49197597edn.46.1525700372812; Mon, 07 May 2018 06:39:32 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:5635:0:39d2:f87e:2033:9f6]) by smtp.gmail.com with ESMTPSA id u5-v6sm12633990edi.79.2018.05.07.06.39.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 May 2018 06:39:31 -0700 (PDT) Date: Mon, 7 May 2018 15:39:29 +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: <20180507133929.GG12521@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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. It should call drm_bridge_attach/detach only, as a pair. I didn't check whether you instead have a _detach call missing or what's going on here. -Daniel > > Cheers, > Peter > > > -Daniel > > > >> --- > >> drivers/gpu/drm/sti/sti_hda.c | 1 - > >> drivers/gpu/drm/sti/sti_hdmi.c | 1 - > >> 2 files changed, 2 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c > >> index 67bbdb49fffc..199db13f565c 100644 > >> --- a/drivers/gpu/drm/sti/sti_hda.c > >> +++ b/drivers/gpu/drm/sti/sti_hda.c > >> @@ -721,7 +721,6 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data) > >> return 0; > >> > >> err_sysfs: > >> - drm_bridge_remove(bridge); > >> return -EINVAL; > >> } > >> > >> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c > >> index 58f431102512..932724784942 100644 > >> --- a/drivers/gpu/drm/sti/sti_hdmi.c > >> +++ b/drivers/gpu/drm/sti/sti_hdmi.c > >> @@ -1315,7 +1315,6 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) > >> return 0; > >> > >> err_sysfs: > >> - drm_bridge_remove(bridge); > >> hdmi->drm_connector = NULL; > >> return -EINVAL; > >> } > >> -- > >> 2.11.0 > >> > >> _______________________________________________ > >> dri-devel mailing list > >> dri-devel@lists.freedesktop.org > >> https://lists.freedesktop.org/mailman/listinfo/dri-devel > > > > _______________________________________________ > 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