Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp829069pxb; Tue, 3 Nov 2020 13:44:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+cv5OyYUdp22ndcKW6hjSocV+QbQCUQnmi+YKZIlA3bJ7sL5mnah1kDU+WxbbpBaimNiK X-Received: by 2002:aa7:d703:: with SMTP id t3mr12130274edq.375.1604439875784; Tue, 03 Nov 2020 13:44:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604439875; cv=none; d=google.com; s=arc-20160816; b=gDBHZmDxwqFmUCU1x3YrR7ELpBzaCC7M/lCR0ZJrGb/FP/RRTeLPjl75+VgO4cBkEA 0hm8ymFqfS1JE83Dp0bkOvx+HemYQqDpuY5vvsxlvDG+XNTvCa5XEFT6rbEiP1FWKAZr UpZurqjo7U/a1HvTA9Wpr/sV43uXPtAzsnldI2Oky6hwqwBAjP44uv7tB8frxlzSpaOB 9cee2fOAqDpfYUSUspvfRQn2cPyecj4xx8qs3XJCk4gzHK9kXXLIB1+y+hQ1v3pmxgBS IUDtSIN7KDlNsKmucXric82RVvy5xn3v5w5UVi2Syb2UB5qPN0veouz6fIe8C05AWUCg +toA== 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=qyFt57NT/ygbFLPxjanZjiGeJJXLxJY3JpCvELLRV2s=; b=FCK9FKd+NaYTcqOqqTVzO0OnTgClPKbzH94CVtGg80ZAnHV6lke1hlITUc4LOR8S+q oNs1MyPWash/VyBgq/ZNP26CcevEXBtLdfdNxxDPOTJKFpjBNBMGXygQMSGRXZkX2iTi Zoq6sKOwxSOk8DR/++NULH8uSxKDOVP17AKUbUXSOskQkkzvSt+0iEMUmgXAcSy1rkK3 gSiWd5OB7YJ/DsmTQsXZhqpkH8XhCMq89UGnHQDo8VoS1pnU8D4chy5wqP5TsCO/Z6dd Z5dEEriFwBrcgbT/TzDDzUUr8+ARcXEoB8uT1JbEoDOoJtAoGB5bkS7Y9yusPjINeFym R0lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rjC6uKnG; 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 w17si58990eji.277.2020.11.03.13.44.12; Tue, 03 Nov 2020 13:44:35 -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=rjC6uKnG; 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 S1732877AbgKCVmT (ORCPT + 99 others); Tue, 3 Nov 2020 16:42:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:56410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732339AbgKCUzi (ORCPT ); Tue, 3 Nov 2020 15:55:38 -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 D556E2053B; Tue, 3 Nov 2020 20:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436938; bh=+VSF1r6M6eJlGhWZiKsgbmeos4MP1gBYm+4u7RwT4Po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rjC6uKnGzBpicN2J1lTULFfnp6/fqu+Z7FcFlvJJloHwsxCpPi2CCljQOy5Mg6aHL Iv+CRVbMMeWUtxQws9ZPC3JTZxxeNFn7bfRikr8NGefgYNBsthQLA5LTSOwDH6arwZ K5n9LiitPLCLA6AHMv6daAxfTWXv2BwH9gMQoCRk= 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 5.4 038/214] drm/brige/megachips: Add checking if ge_b850v3_lvds_init() is working correctly Date: Tue, 3 Nov 2020 21:34:46 +0100 Message-Id: <20201103203253.650095903@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@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 6e81e5db57f25..b050fd1f3d201 100644 --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c @@ -295,8 +295,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); @@ -354,8 +358,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