Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9243661ybi; Wed, 10 Jul 2019 07:04:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIAZyvusQ+Mg6GPpb02PSdHcgRRh5gU929Lf8pWaSE5d+9y/QvSQlHAgs0YECO2z34EY6v X-Received: by 2002:a65:62d7:: with SMTP id m23mr5140320pgv.358.1562767469080; Wed, 10 Jul 2019 07:04:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562767469; cv=none; d=google.com; s=arc-20160816; b=VYJjhX1VJDuCQa5SAW4v1cMiJpdaNTIcO2iAOF3taQcnXZzkslY8+9wIa8pEMGKZTp rdLO1TjzMzOoFuWGAElJDqgHmiW6WStNRTZ9qtTw2omdnKGyWiI81XeujB10B2EYuDBE Kw8ZV4JwI6tzZDPpbL/DE2epSq9m2zJ2y4r2buedqUfgcy0DgRURlPBINnMM/GH4a9XP IDk2Ld9q3k20lMcGveOGb9dghMl3L/bOJYlR2pJWaJQO0taUzifEJ84cJB3xLmDGCjAY jSYX5yLS60CsSSknxkY0uNFv6MEVoCl2rvLI/ll00dn8d/3ifhwHSWNbvbWpn7F//50T xZDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=2GPFpTiWfd8hx/L3TEHsm8trnZwkg18NUyiQIdlDfIM=; b=xlocgLYfm/rcDjpO6s1AHf9lxKjc/mUd7q/eaNXYLnJd97F+JJAZBUOmENF7UO/0im KTzwUy17E0JaUa62ZPDegdzR9Zz7WtKjhOey772cISZ3geurthQ+AvVL25f6WQfmZU1V jdSXeQEL351vmwiUPDCa9AcXtVs2vNCVLX5nR9SfzgaaB61RLS4QDLOMEYVPik+IzE53 +uIEcQkAg+lbeFhIbB1c5EiwPDmWQGbNfqPd+9fiYnAtjnPXWn0oq3ul6u8v+UT/WrV0 G5moDfR4+Leb3Jx6gkD7UiEDExUloEuVzrZT7hcMMTGtt7wVOQacv+Y4KyOIKjZJufD2 e78Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E+U8F6c7; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 124si2406363pgg.581.2019.07.10.07.03.57; Wed, 10 Jul 2019 07:04:29 -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=pass header.i=@gmail.com header.s=20161025 header.b=E+U8F6c7; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727718AbfGJODa (ORCPT + 99 others); Wed, 10 Jul 2019 10:03:30 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:45211 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726098AbfGJODa (ORCPT ); Wed, 10 Jul 2019 10:03:30 -0400 Received: by mail-qt1-f196.google.com with SMTP id j19so2470298qtr.12; Wed, 10 Jul 2019 07:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=2GPFpTiWfd8hx/L3TEHsm8trnZwkg18NUyiQIdlDfIM=; b=E+U8F6c7toIoLMK8dCSQ5NefkMuteVs7bE2v2Gxnz6xPcO/Nvtg9p7Yn1vytOTyal7 Ax/o+vjgetf+EQlNX4U/QjKFNcBec2CVHPANsyN9Udply1mNbKSAOZuJ6S7r08tkJxT+ FBEccbsgIz0tKkZTokXv0THhpVlHQdXViepthEHBzuLyW94YsJudoBlVEpXC8uXbCRLz Cnq+fu7EYI+RlF7+mqT0oykNRisIMDm2FpkeKErVrNdsfB435ArTw+Slnj5jZNLsnDI6 iOUVRAGmF2IryPYBMu3vcyiW1iUEQ2/pkbgYZur9CH+LDrx3PhMmqANx86ntSQ9inepI YlvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2GPFpTiWfd8hx/L3TEHsm8trnZwkg18NUyiQIdlDfIM=; b=rlr6X0+xDs4bAIkfFoRgC6UnZRBk3reCmmVxGKsCUj9eSexL+9SHHSsmQo48lclYEv pZuyqHuIrceZB+eG64lSmF7+tR8mI3hVn6YpbC7FYiU9SAak2wsgddL95Q48ydYe89Du 7y24EIdKo5B2uveeLxouEZeDx6gsq/RjitL7WXHKRAudoIuAUtw5pTEKMvdYiTD1sLDx vxq0H3GaV8gZiLtZyINoOjm8xyOlL814/qlV7gIznC4Iuzmf7OYF1Bf7MlY6W5tUlvMj Evqz08KbHiuF3bp9MqTFmFU3l2NO5nYC8XwV75fux35ode1cqR/hzyUyxFUInTMOXbeu PNrQ== X-Gm-Message-State: APjAAAUI9IXAA+pLDkKvxdXoJHrKXAiofWbTTzoN3wz9NfznL9n4Dg/B 90sBhmutayk/lIxEwqX6U4k= X-Received: by 2002:ac8:25e7:: with SMTP id f36mr24084696qtf.139.1562767409534; Wed, 10 Jul 2019 07:03:29 -0700 (PDT) Received: from [192.168.2.145] (ppp79-139-233-208.pppoe.spdop.ru. [79.139.233.208]) by smtp.googlemail.com with ESMTPSA id r4sm1772193qta.93.2019.07.10.07.03.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jul 2019 07:03:27 -0700 (PDT) Subject: Re: [PATCH v1] drm/modes: Skip invalid cmdline mode To: =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= Cc: Thierry Reding , Jonathan Hunter , Maarten Lankhorst , Maxime Ripard , Sean Paul , Daniel Vetter , David Airlie , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20190709145151.23086-1-digetx@gmail.com> <20190710100000.GZ5942@intel.com> From: Dmitry Osipenko Message-ID: <73d5dcd7-adef-8844-4e13-a68a0a5db98a@gmail.com> Date: Wed, 10 Jul 2019 17:03:23 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190710100000.GZ5942@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 10.07.2019 13:00, Ville Syrjälä пишет: > On Tue, Jul 09, 2019 at 05:51:51PM +0300, Dmitry Osipenko wrote: >> The named mode could be invalid and then cmdline parser misses to validate >> mode's dimensions, happily adding 0x0 mode as a valid mode. One case where >> this happens is NVIDIA Tegra devices that are using downstream bootloader >> which adds "video=tegrafb" to the kernel's cmdline and thus upstream Tegra >> DRM driver fails to probe because of the invalid mode. >> >> Fixes: 3aeeb13d8996 ("drm/modes: Support modes names on the command line") > > Is that actually true? This problem has been in the code since forever AFAICS. Yes, it's a problem now because named mode is marked as specified and everything that do not match to a non-named mode is treated as named. >> Signed-off-by: Dmitry Osipenko >> --- >> drivers/gpu/drm/drm_client_modeset.c | 3 ++- >> drivers/gpu/drm/drm_modes.c | 6 ++++++ >> 2 files changed, 8 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c >> index e95fceac8f8b..56d36779d213 100644 >> --- a/drivers/gpu/drm/drm_client_modeset.c >> +++ b/drivers/gpu/drm/drm_client_modeset.c >> @@ -180,7 +180,8 @@ drm_connector_pick_cmdline_mode(struct drm_connector *connector) >> >> create_mode: >> mode = drm_mode_create_from_cmdline_mode(connector->dev, cmdline_mode); >> - list_add(&mode->head, &connector->modes); >> + if (mode) >> + list_add(&mode->head, &connector->modes); > > That's the same as what I did here > https://patchwork.freedesktop.org/patch/309223/?series=61781&rev=1 > > But I'd have to rebase that so let's just go with your patch. > >> >> return mode; >> } >> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c >> index 910561d4f071..74a5739df506 100644 >> --- a/drivers/gpu/drm/drm_modes.c >> +++ b/drivers/gpu/drm/drm_modes.c >> @@ -158,6 +158,9 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay, >> int interlace; >> u64 tmp; >> >> + if (!hdisplay || !vdisplay) >> + return NULL; >> + >> /* allocate the drm_display_mode structure. If failure, we will >> * return directly >> */ >> @@ -392,6 +395,9 @@ drm_gtf_mode_complex(struct drm_device *dev, int hdisplay, int vdisplay, >> int hsync, hfront_porch, vodd_front_porch_lines; >> unsigned int tmp1, tmp2; >> >> + if (!hdisplay || !vdisplay) >> + return NULL; >> + > > These lgtm > > Patch is > Reviewed-by: Ville Syrjälä Thanks!