summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Novikov <novikov@ispras.ru>2021-05-19 15:04:49 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-20 17:17:32 +0300
commit0b4d122394e9ede5ca44d2600eacb5ddaef50a3d (patch)
tree0e6643682cfe33b910da09bb4bd9aee3c75a1869
parent7069eeff5f11d6e80b781a8368cc9605d0de99b6 (diff)
downloadlinux-0b4d122394e9ede5ca44d2600eacb5ddaef50a3d.tar.xz
media: st-hva: Fix potential NULL pointer dereferences
[ 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 <novikov@ispras.ru> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/media/platform/sti/hva/hva-hw.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c
index 1185f6b6721e..3bb4d55c2058 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;
}