Skip to content

Commit

Permalink
media: st-hva: Fix potential NULL pointer dereferences
Browse files Browse the repository at this point in the history
[ Upstream commit b7fdd20 ]

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>
  • Loading branch information
eunovm authored and gregkh committed Jul 14, 2021
1 parent 617afce commit 74ef241
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/media/platform/sti/hva/hva-hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 74ef241

Please sign in to comment.