Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3600695pxb; Mon, 24 Jan 2022 13:14:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxl+0AKQfFLZ3K6T9Ue+n+LRfbveFM4K2UDdULGrYm3ckLG3fAEhS46pXkFyflCF3tmmxww X-Received: by 2002:a17:90b:4c89:: with SMTP id my9mr226727pjb.74.1643058843744; Mon, 24 Jan 2022 13:14:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643058843; cv=none; d=google.com; s=arc-20160816; b=V5C4gvLX63dgUG+qU7c2NMG1TkOddj6c76NuFOVi1E11JBKr359838+KWXZdZ+W+Zx 63lX+AMxTA6X3jEFA96vZE8UL+SrCQ7ZztxZmTSpAOyqoPMOHU3DLlc1K8tb6DdRpHpO PsfRV75E64jCDkiVe8xnACDP1h9DhwdsNKuax5x67qKDU8rT/M3UYtxp6Ht8A3msMM5l ksyp1WyFH/t70Uz/OLn84js1p6eLYvvBf+MQjzfYkkcnqphOuAhDiFQhhNxFbj/mg6fq XB4rozvCXdIzVLfu6J++Klgcokql1vca6m1T6+vFDOEEuELkBxqZaTRWBc4CcpGR8eRt jaDw== 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=vZTywqf9vmJbmcvAevWUxRkVeYddjaqqcwGZhnXg7aM=; b=WGEiySnY8AH7DOk3Wy0gm3bP3JymQIhJBINkVWSX9pX7Gas16SNqPTsUu+YltOhtLp nWhX9q5wOw4Jf4cpazj7ouwUBqlXP9oiSY5QLkUev8XV6qIBKedmY3f541BrUAkv/K9z 5ykW8nxxG5CiXHkwk8aqn1Fxjj/FjABgtq8pSEAhbRUNl2LcqpwMTmskMrJvihSE/LJh KJeTcb5vNWZngztFfcj4AjVegPPaVHhjncO1KXS4zSzazScZxuZZ5PD4oVpGRHm/N3ti MqifGir/NbUIFlSuR5+wJVCEUDtKUaSNWd5s7lBmT5k1R3/pjDgbPNISUbkGK11SVuXz 5wNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zEqO1unH; 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=pass (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 e36si13728453pge.147.2022.01.24.13.13.50; Mon, 24 Jan 2022 13:14:03 -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=@linuxfoundation.org header.s=korg header.b=zEqO1unH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388572AbiAXUji (ORCPT + 99 others); Mon, 24 Jan 2022 15:39:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57616 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355840AbiAXUSY (ORCPT ); Mon, 24 Jan 2022 15:18:24 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0C7F8B810BD; Mon, 24 Jan 2022 20:18:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B6CFC340E5; Mon, 24 Jan 2022 20:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055496; bh=LbaWiAw0bZL8X+W8SlhBM2W2+1zuaaar/nyfCzhiPg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zEqO1unH9PAFqUt/m/Z06zDzfLOo3PqqPMBH8LEkWh1EfZHjwm44Orp8L2YS8WGUT lXk4QRXFatOqVLfpYjBJt2sJ4IMND7TG43LF7P3v6UyDf4RBKGK/D44UV5zHWFEgwh L0nXutEEsKX3Cvsf/ufp6FDjj6PrH8HP1kKgqBTA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 170/846] media: venus: core: Fix a potential NULL pointer dereference in an error handling path Date: Mon, 24 Jan 2022 19:34:47 +0100 Message-Id: <20220124184106.847044683@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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: Christophe JAILLET [ Upstream commit e4debea9be7d5db52bc6a565a4c02c3c6560d093 ] The normal path of the function makes the assumption that 'pm_ops->core_power' may be NULL. We should make the same assumption in the error handling path or a NULL pointer dereference may occur. Add the missing test before calling 'pm_ops->core_power' Fixes: 9e8efdb57879 ("media: venus: core: vote for video-mem path") Signed-off-by: Christophe JAILLET Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/qcom/venus/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 91b15842c5558..84cd92628cfdc 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -472,7 +472,8 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev) err_video_path: icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0); err_cpucfg_path: - pm_ops->core_power(core, POWER_ON); + if (pm_ops->core_power) + pm_ops->core_power(core, POWER_ON); return ret; } -- 2.34.1