Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9010873ybi; Wed, 10 Jul 2019 03:12:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1AM8qeCndvn1mdCeQuTyuPU3gEteOTkUs3sqvobK11xSd6H+s/Qrd7dZGh05tS5xe1A+f X-Received: by 2002:a17:902:8c98:: with SMTP id t24mr39040011plo.320.1562753567045; Wed, 10 Jul 2019 03:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562753567; cv=none; d=google.com; s=arc-20160816; b=yBQG5BgHrJye0JOGNchD6zOvdSXk/tL9CH/Ny2kv/nicFCzBs9PHIlkSf6MoQgcW3Z ykzuEhv3KNgH15/8aWvOJIEdwmLuH4AHN68U8wGrGQV5g9ZxSoO6aQlokV47kp0iEzW3 lcHuHNx0bmdS7f+SUltpuYQ6vWbFzRf8QQAPV8JGBNDu51LiRXqURTz+f6U2GhXtOHDG ZPZTAYAcb4xs+Vz51c5MEy33ogzu61YQX6R0se0vDzvma09HGDTq+C1bDJz0WETSXdt4 SvdJgb63P2DVNH2YhEXa/vx4LloG+BZ7xU46YJJ15dSi3wdamktzvyy3KiyzTOWJpdCU 7vYQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Xnth9n0xSscmc0ru/Mp3ULe44ljcsvsFdE2v3wzSUhQ=; b=nuyfN+nLriV2NFLYSsdkOWrxriqo36HKSf283QO4ZShW3/0S3PtROuirDdiPfrCZvO PK6bOIww8B3mrPBnp2tjsIcwqe0sXHMK+vD1ZK7kFppOJvD6KRkn1W5lpp0TKiswe5w2 OdmE8BWmtbhWdSJoUEYWra38iaS5C/n7u3SD8pydwDfmNlEGWiZDTgvMWvLwiMK7vFFj 4py/Pu73lFWKzK/CuOivV4+2OSw6M6tMH2wuKZldeSWEgtVht4H0qlvWFIDWuQF+M44v re7zCBLDX3yrbkMZA7GElmZO5Z9wW7FyK+IY9Ap/WuC50d+3Tii4CDzhWAXEO+Jtr/PP lz1w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si1779379pgc.321.2019.07.10.03.12.30; Wed, 10 Jul 2019 03:12:47 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727465AbfGJKAF (ORCPT + 99 others); Wed, 10 Jul 2019 06:00:05 -0400 Received: from mga17.intel.com ([192.55.52.151]:42541 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbfGJKAF (ORCPT ); Wed, 10 Jul 2019 06:00:05 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2019 03:00:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,474,1557212400"; d="scan'208";a="186111514" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by fmsmga001.fm.intel.com with SMTP; 10 Jul 2019 03:00:01 -0700 Received: by stinkbox (sSMTP sendmail emulation); Wed, 10 Jul 2019 13:00:00 +0300 Date: Wed, 10 Jul 2019 13:00:00 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Dmitry Osipenko 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 Subject: Re: [PATCH v1] drm/modes: Skip invalid cmdline mode Message-ID: <20190710100000.GZ5942@intel.com> References: <20190709145151.23086-1-digetx@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190709145151.23086-1-digetx@gmail.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 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. > 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? > drm_mode = drm_mode_create(dev); > if (!drm_mode) > return NULL; > -- > 2.22.0 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrj?l? Intel