Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp882591pxb; Tue, 3 Nov 2020 15:26:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJyAAN6re7gTvplaKvelrybE1bkr0YmV4371VQ7U0x4Uvj62I8kfHbOIZ7apO01a+sxA/pCd X-Received: by 2002:a05:6402:10d5:: with SMTP id p21mr24408345edu.327.1604446007033; Tue, 03 Nov 2020 15:26:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604446007; cv=none; d=google.com; s=arc-20160816; b=XsZk/1/1R4Sr5BiGYzaw5P6ajrxWZK4eFdqVuu8G9/Yv7WW2EZcHgw+28xttqPRXj2 aeMBcS7+806lWKlmYWXow35tC82HiUhRJfyeCiXk5hF0pvLIlpinCpxMCtw35s2n0gRE j7tDGUE11ZlzAdhFnske5OV0PSk1vnsyBvgopxD7JPKm+RzSL3ygtGql4Nn/l1Eb9268 v4lfO09+U6F7cnabGla8DYJr9bUxXQaSG63knAYC4j+54uCqNyirW3HcZleOJv5zRN89 YKcLfqzpt+Qv37I0Whe0ERyP/rYTlkku4iV0mhuZkaWN2M5ILhXwz2swA1MWfCNj5akb /6dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sf+wRuRtmXv4UIcybqCbHq5yc8uVo9Wp+GuXPssMA+g=; b=nZ6DtXq+oPJ2F8UWjYN5L6tmAvrXL1rRrDFewhw1wvH0RYBzFbsN0+GJ9qNc+NdYCr slQ3fjzTG3ey7Hnw109TOo0OGn9DSJcNKZo++Iu+f3JoV11gASI4KpzbcvYbalczFgTt +tVKp2P8PKjU+9L/0fkisIQ64rfzPcRPNLnEKI3IXz2urqody7ht/F6psEViOrj22+M5 pGaMQX15uVc6evaZyIgq1R2Gn2w7tJ2pKdTsUYnlSKmo09JtYEe7kJc0Dm2LugeNVxFM 1x0Cv/yj/a5/gS2KACzCKp8aqvnyT5FZh4CPX505glVvVss05EAp+dBBpmoBj0KdgXhT 4jFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=icCRQUND; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga5si323541ejb.198.2020.11.03.15.26.24; Tue, 03 Nov 2020 15:26:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=icCRQUND; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733220AbgKCVYc (ORCPT + 99 others); Tue, 3 Nov 2020 16:24:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:41324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387856AbgKCVDj (ORCPT ); Tue, 3 Nov 2020 16:03:39 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 60543205ED; Tue, 3 Nov 2020 21:03:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437418; bh=TOIoBaueou4g9EtXQvy9g16XDRTWHWe8TNfjnYSWNIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=icCRQUNDITCtdmwKFLTFK1whYWIESWZKdS0t2CuI7Q1ZXB6AcK+wlnBhrOmSzPeCr 6zS3HFsb9RMK24OJOKxsMAeWHGk6o2gRHdhPnouxWhJgwSnXFuIzx0aL4sMIO3P4Ht mcayGTTSiu/+zMxJG5SUHUMUZTG6cq3TpsckGBXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nadezda Lutovinova , Sam Ravnborg , Sasha Levin Subject: [PATCH 4.19 068/191] drm/brige/megachips: Add checking if ge_b850v3_lvds_init() is working correctly Date: Tue, 3 Nov 2020 21:36:00 +0100 Message-Id: <20201103203240.868010841@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nadezda Lutovinova [ Upstream commit f688a345f0d7a6df4dd2aeca8e4f3c05e123a0ee ] If ge_b850v3_lvds_init() does not allocate memory for ge_b850v3_lvds_ptr, then a null pointer dereference is accessed. The patch adds checking of the return value of ge_b850v3_lvds_init(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Nadezda Lutovinova Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20200819143756.30626-1-lutovinova@ispras.ru Signed-off-by: Sasha Levin --- .../gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c index 2136c97aeb8ec..dcf091f9d843f 100644 --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c @@ -306,8 +306,12 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, const struct i2c_device_id *id) { struct device *dev = &stdp4028_i2c->dev; + int ret; + + ret = ge_b850v3_lvds_init(dev); - ge_b850v3_lvds_init(dev); + if (ret) + return ret; ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); @@ -365,8 +369,12 @@ static int stdp2690_ge_b850v3_fw_probe(struct i2c_client *stdp2690_i2c, const struct i2c_device_id *id) { struct device *dev = &stdp2690_i2c->dev; + int ret; + + ret = ge_b850v3_lvds_init(dev); - ge_b850v3_lvds_init(dev); + if (ret) + return ret; ge_b850v3_lvds_ptr->stdp2690_i2c = stdp2690_i2c; i2c_set_clientdata(stdp2690_i2c, ge_b850v3_lvds_ptr); -- 2.27.0