Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3344368pxv; Sun, 4 Jul 2021 16:07:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6a8zwq0VHERLYGGxckZj4I64exAfUQJ1dPDNBhIgYN96J9NWwNtDJ/OS2pRurqe5oM7if X-Received: by 2002:a5d:960b:: with SMTP id w11mr9554009iol.138.1625440031847; Sun, 04 Jul 2021 16:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625440031; cv=none; d=google.com; s=arc-20160816; b=VaRDa8Jus8IOosXwbij6nuoeqGVBoFOmHBRgZcyTdbHXupeGQifD6S60M5GtEbamli uzHqoXLjnEnrAVv8bnRpmev8VRv2DcJWlSRAWxgrdPCBfHrXu7e3uQdMuaakfDpXW0QO eMqNRafQgzBCi+JlEkJVIABYAQDKM5lgpIqQNjxWcTplJeO0nc90blriIEMrxJ1zTies O0cfNQOm+Nf2YdlelfUAWxotJEXzX+eOH2NV8sZo5RNiIpyN37/9QjzdC3QU59F35HWu qRT34nsgxp+46QFZaG1Q48nL/uvep8SC0COjThLjoORdKl9mJJo1wZUF40ELvogWX+Ju zPKg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=N6PABYqgwxxrVsyyQRGwHhP3RNbaJOb9UPhjH0+1VWk=; b=OULD6j9K6wtUowUMFt403r4SgGuuN11r2FUNNtN4odEqEF9mI8MjCY5ChRuhne/5VD Rn4drWgtj0fUr08MPYr/BsrjDXumaqf2WojL64DE/s/S8TgE0o+M7AFtM6j3lM3oe8r/ 8nhRTXk6gXFd/i6KZ6bB5h1JDEAd3blOZtS/Zwt71zd+kFsrj4OYfl/69+Iglr+XRlE8 jsW7H18xB8/HcHqClHwlYPmP32uBCAzQfvZS1ABVR39ulcAULG+xJTF1ynCI9y+rfvcQ Di80PxZPsaJDwkR3GDdrUXQ/cLi9eLYitv/wNVZdsRlmmrq878LSU0DZRRGXXS5l18aZ o2LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T9IzHrxQ; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o192si12650810jao.55.2021.07.04.16.07.00; Sun, 04 Jul 2021 16:07:11 -0700 (PDT) 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=k20201202 header.b=T9IzHrxQ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231332AbhGDXIg (ORCPT + 99 others); Sun, 4 Jul 2021 19:08:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:46686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230488AbhGDXIA (ORCPT ); Sun, 4 Jul 2021 19:08:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6660A613F9; Sun, 4 Jul 2021 23:05:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625439924; bh=b+dbzik4gF/bptX3LTN5yD5r59X5tqhaXyxGi2QAB1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T9IzHrxQ4AZYeGak7mjV3nz3Jkrfzl3+WnbAunzaQ9b7qsjwHOQmVV03H3mmDXuN6 6gzHxzEz19PQbksLBQ4qRjMYJSrvcK5TRO2VDYKbdgTJ6C5x5OTRVWbMqd7plYwecT f8ZR/HcSfkuUBryozrkGFg7QEC/6RHo7bWzcyUWJXLQfSRPTAffW7wNzYVeCO1hmAJ hvESIcOud4axCX5KW5Fcz/dcStRkbUKsGNRKEm9rZJzDe5Wzk1Fiw5UuR8dMJtF4/T Mvjnlb+e5pluaMTaphHGV06XdZ4FKjYVfSRZh43Xw5z29NvZYdmw6HcoDrhsRoFXmu q41A7rN1TTgEw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Evgeny Novikov , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 5.13 46/85] media: st-hva: Fix potential NULL pointer dereferences Date: Sun, 4 Jul 2021 19:03:41 -0400 Message-Id: <20210704230420.1488358-46-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704230420.1488358-1-sashal@kernel.org> References: <20210704230420.1488358-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Evgeny Novikov [ Upstream commit b7fdd208687ba59ebfb09b2199596471c63b69e3 ] When ctx_id >= HVA_MAX_INSTANCES in hva_hw_its_irq_thread() it tries to access fields of ctx that is NULL at that point. The patch gets rid of these accesses. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Evgeny Novikov Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/sti/hva/hva-hw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c index f59811e27f51..6eeee5017fac 100644 --- a/drivers/media/platform/sti/hva/hva-hw.c +++ b/drivers/media/platform/sti/hva/hva-hw.c @@ -130,8 +130,7 @@ static irqreturn_t hva_hw_its_irq_thread(int irq, void *arg) ctx_id = (hva->sts_reg & 0xFF00) >> 8; if (ctx_id >= HVA_MAX_INSTANCES) { dev_err(dev, "%s %s: bad context identifier: %d\n", - ctx->name, __func__, ctx_id); - ctx->hw_err = true; + HVA_PREFIX, __func__, ctx_id); goto out; } -- 2.30.2