Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3346075pxv; Sun, 4 Jul 2021 16:10:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmjMpHoRCmHX4yCnB7h+F7f2Z0qopfcO6l5F9UU7wJwf0ZzRKyOLNxQKI+bkxX6tDWCN+N X-Received: by 2002:a17:906:7393:: with SMTP id f19mr10383839ejl.533.1625440223270; Sun, 04 Jul 2021 16:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625440223; cv=none; d=google.com; s=arc-20160816; b=NumqVv+MaNmKVFpB+Ej1/Uy2rGruVCtO0r3Y65VAzeDMUexeiNK2l/5PshjBl7wmHy ahgJXhWHsJ80Bfrgz3nYpKQzIB0C4Vsedfr4JMjRQdehFqR2eVvlPoMRxp7ZZ8kyffFV x//9xsVSvuGW/GobOPyoIqFVWOKnTYagjWB1HuUZ3YYCpK0kjhLkIIEwVJx4O7WawlAv aRNJgWKnCbs+mD/BITAaR2xnEd9nykZwpJEBAW92fVGlHIPpAxnyKdMZGOaPD5RWWIFX 5qzFGxctWjxHI02e+664DB4+L542i+rFSryIkCi0k9/NrFe3bKtyHgoBZFx0yyLU9jnh 1NyQ== 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=Endi1k4JjJZo7IrLtucrX+YNa2A+dbaG/Hcc1mdnHonAp0YRoo0MZqAMldwtzC9U9Q jbn1QaxQcVAE+s05XrEdOMeI9NunmcCiahnyCGE05Yw6h+lveyNlWy1MVX4omoilqrHt +/z8au7P+dSMrMXGUDrZpzKzgLUPEXHxixUoZNFvgChAckOMj/6g/peYPI5viPuh/MJR FR9dvx7LzODZceNJnV1Bb9KQx+sDdyB2ne192TLnutqNg3D4yTprYA7jH2AgePV8g3Ms keN7nPSCl/AyCUm84o+TeOLxDVzdB9nYf+pQfSAlLWYvQVzhq+HAd1P1s0x7jcDetfm2 0tYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pUYUEmzT; 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 y7si9003857edw.145.2021.07.04.16.10.00; Sun, 04 Jul 2021 16:10:23 -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=pUYUEmzT; 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 S232605AbhGDXLa (ORCPT + 99 others); Sun, 4 Jul 2021 19:11:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:47610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232131AbhGDXKD (ORCPT ); Sun, 4 Jul 2021 19:10:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3E54F6193E; Sun, 4 Jul 2021 23:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625440037; bh=b+dbzik4gF/bptX3LTN5yD5r59X5tqhaXyxGi2QAB1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pUYUEmzT+NwCWLXnpoOd8fTlsXjnenKtEoZvQCIHWLwkMkTfehjJqql6o9E7x3mAO Xvi3iizCZRYysEUS8FxWyiWTvqNIq4ej7PTOUmBkZqPkmhJBZWHi33seTq9FL5Zy5Q 5i5x1zbvcI5o2Rju2qJ4P5iq62FojDVwnSZNFs5bxUMei5wvMzhZizB9gceEDK3oH9 iMJQzuKCg391C0A+BAcYrvNxVMrkzBuIzuqkFFqroz+zl2Vc6Gil4W8+y1euc9Xhe0 A9FwFiVwcXZ/E3SvhjSAy4EhGr9Qaydn5CXVDCsc9805jr9q8s6nrpurRV+xnHyCdA osT4oAbkcOOCQ== 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.12 44/80] media: st-hva: Fix potential NULL pointer dereferences Date: Sun, 4 Jul 2021 19:05:40 -0400 Message-Id: <20210704230616.1489200-44-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704230616.1489200-1-sashal@kernel.org> References: <20210704230616.1489200-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