Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3235523imu; Sat, 24 Nov 2018 00:45:17 -0800 (PST) X-Google-Smtp-Source: AJdET5cuZhcjnysYiBxOWs87P24NWkSrhl7ZPT59nDVBb6U1iLHY/N5M+G3GMeAxblyAeAc6FBD0 X-Received: by 2002:a62:2b17:: with SMTP id r23-v6mr19813137pfr.251.1543049117320; Sat, 24 Nov 2018 00:45:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543049117; cv=none; d=google.com; s=arc-20160816; b=tZ8tVrcd+JzRkn6oX0VL17bJfXpbFofNMWkX20mURQsA82vg+pMCk8Z+1oc7dzlat8 DO3tQmVSepPO3gnIIoFyWgFqvn/cf47Xt8eC3y1pGD/f9cW6n7jXMrT7Aqc063icM+qN IH97R8RntkbO6Q+a7BvHDgHBiq8f2q0PrAKxZC91uB7PMuYB+Dc4fLRuM3RcmtIYxNYy 592YYNS0jtIwSCBlLZBEsTwF+aS+FK7OFATPs62p/sraQKz3z4sbVENuYq1qGzLRvOXm fiuIstO2dGDBP6PPGHamdzyo6Vtom2Iu8E7ERldZWFOA+j4lAPFWaNUFxKYXw1TMIGPQ k/qQ== 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:message-id:subject:cc :to:from:date; bh=L6PHpqadkg1NJTBS3fwi9fN6vsOCBNmv4IV65AkUTTg=; b=rs2NnSkXXOr7xsg8zzlZn7wWMSvKsT3t77wBorRlPryh8c/EYqQALs2vRfIFZNSPMs 5ZzkY/FLzP4KZpwRRQNnX6LnIgUKlMkSQRrivTTWcm3/lwPhHRSXZyvJZOo/FHlqnHAU yEf1MNiHRBfJ6BAsuj/KCo1C/QLcyvcI5b9kIo5N4EXv0AKzEDeW1fTwxL5QYLOnaeIY EjLC+pvZ1uWojokhZ/h38tlxhzlHt1ccs1XUvm8KkgTFgjPLSh2fbdwEXwYMADcKlEkA 90lWh/x5RKPzGyaWPkYKGeuQLEyJYtQaa339PNc/xur7OObJXerLEjzeEjxSesHq7ytO IZ8Q== ARC-Authentication-Results: i=1; mx.google.com; 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 j14si42464729pfd.113.2018.11.24.00.45.03; Sat, 24 Nov 2018 00:45:17 -0800 (PST) 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; 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 S2440891AbeKXESZ (ORCPT + 99 others); Fri, 23 Nov 2018 23:18:25 -0500 Received: from muru.com ([72.249.23.125]:54936 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732672AbeKXESZ (ORCPT ); Fri, 23 Nov 2018 23:18:25 -0500 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 4BF6780D4; Fri, 23 Nov 2018 17:33:15 +0000 (UTC) Date: Fri, 23 Nov 2018 09:33:10 -0800 From: Tony Lindgren To: Sebastian Reichel Cc: Sebastian Reichel , Tomi Valkeinen , Pavel Machek , Laurent Pinchart , "H. Nikolaus Schaller" , dri-devel@lists.freedesktop.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com Subject: Re: [PATCHv5 4/6] drm/omap: fix incorrect union usage Message-ID: <20181123173310.GI53235@atomide.com> References: <20181121160916.22017-1-sebastian.reichel@collabora.com> <20181121160916.22017-5-sebastian.reichel@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181121160916.22017-5-sebastian.reichel@collabora.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Sebastian Reichel [181121 16:09]: > The DSI encoder sets dssdev->ops->dsi.set_config, which is stored at the > same offset as dssdev->ops->hdmi.set_hdmi_mode. The code in omap_encoder > only checks if dssdev->ops->hdmi.set_hdmi_mode is NULL. Due to the way > union works, it won't be NULL if dsi.set_config is set. This means > dsi_set_config will be called with config=hdmi_mode=false=NULL parameter > resulting in a NULL dereference. Also the dereference happens while > console is locked, so kernel hangs without any debug output without > "fb.lockless_register_fb=1" parameter. > > This restructures the code, so that the HDMI mode is only configured > for HDMI output types. The new function also has a safe-guard directly > before accessing the union, that can be optimized away by the compiler > when the function is inlined and HDMI type has already been checked. > > Fixes: 83910ad3f51fb ("drm/omap: Move most omap_dss_driver operations to omap_dss_device_ops") > Signed-off-by: Sebastian Reichel Works for me: Tested-by: Tony Lindgren