Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3696174pxb; Mon, 24 Jan 2022 15:37:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyShb6ENe8LUeIDWxMrIQfc6MD/OWoKenSnA4O7MSi1kaaXyES5yOO+o2AZxb6eyFvFTTE X-Received: by 2002:a17:902:8c97:b0:14a:ec66:bbb0 with SMTP id t23-20020a1709028c9700b0014aec66bbb0mr15969322plo.68.1643067451178; Mon, 24 Jan 2022 15:37:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643067451; cv=none; d=google.com; s=arc-20160816; b=r9ERGvAnhNo/jQb+nBf2MikSAKeTQLHRR6MpiFwhcnJLKqBIjVi5Kyl0NN3bQrparq DsveEDKYyZrRI80Ws+4qHaaS1QGMSiR8h/5L05otTFoXbzIvybci3JMcxxv7J0wTKr85 67qA70WWTkvHbCwGdgrtlPHZhYQzME7sBW7g/L633VdCWECbSa+pnPJQ+uwqQsqt9OOB xEHCzcg26I/jQeCzEQ+fslgbTONj7WbHLbLTWk1nxtOU78ahsVFxI+CyF/qa95oN5CnG 4cTnkS6SzCSFRSC31Tg2+qDOlXAphnFVTTIsPzPJam0/Porh9BNcT4+U5RYFp0r1prV6 2WGQ== 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=+2AQgh43crYENqu5MSssk4uVAAcy4wjfq9c4uUKiVmE=; b=VxaaZCjBqDqe4u8wo0sWVcqSMM0zK/K8gFXWeNHv6iYnTK9dFrZ2s4uVNLJOZIzCQ2 jyx98a3tDZp50etwa8Z1jR2s8OrXLa/ftcVodGEgOvgBTm9LfaGwcla+R7c0Z69bLt8v 9ehBy9glnhvpy0b+aIoL2UJM7nM1HXMzM21LuMWFSUlpr1tN54edI7OUO5qfnDVOfRzL KyP8S1UH44jgrft2trRuT2u4vSkCpwlLqPESU/32UNXddVsz6icMn2j93j3bT/h+7rpu XKfmicl80zGGNOfMC7k9ODuS2Rz0pUh92pdFD4VyfzLJ4GnWLYz4f6AyHHlQnPJUlU1P bXJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YTFwCVIa; 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 e7si4370517plh.419.2022.01.24.15.37.19; Mon, 24 Jan 2022 15:37:31 -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=YTFwCVIa; 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 S2359495AbiAXXcm (ORCPT + 99 others); Mon, 24 Jan 2022 18:32:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456644AbiAXWjw (ORCPT ); Mon, 24 Jan 2022 17:39:52 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6959BC04D61A; Mon, 24 Jan 2022 13:04:16 -0800 (PST) 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 31945B8105C; Mon, 24 Jan 2022 21:04:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E5CFC340E5; Mon, 24 Jan 2022 21:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058253; bh=sLeBLzFgVT8t1e9qRMlDmM/Em1aCfW1X4MlX6q4CEq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YTFwCVIalOb6G4HDq8ITDUNt4JpKZqm2fqyR8BtPaRtpR0YRUrQ5qyaCPxXgCizEz zxGpy4IlL7jbNo8cvUUQeMSXD5KFtEwVpCdJBLFzlARcnzros4lK+8goybmRwTQIvI mynFWmFDOLC8jzXUO+btkzzhFP/ch0REUPp7DjeQ= 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.16 0196/1039] media: venus: core: Fix a potential NULL pointer dereference in an error handling path Date: Mon, 24 Jan 2022 19:33:05 +0100 Message-Id: <20220124184131.917171588@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 f5fa81896012d..fd32385485fa6 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -473,7 +473,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