Commit 19e1c444 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Sasha Levin

[media] af9013: Don't accept invalid bandwidth

[ Upstream commit d7b76c91 ]

If userspace sends an invalid bandwidth, it should either return
EINVAL or switch to auto mode.

This driver will go past an array and program the hardware on a
wrong way if this happens.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent f162b656
...@@ -605,6 +605,10 @@ static int af9013_set_frontend(struct dvb_frontend *fe) ...@@ -605,6 +605,10 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
} }
} }
/* Return an error if can't find bandwidth or the right clock */
if (i == ARRAY_SIZE(coeff_lut))
return -EINVAL;
ret = af9013_wr_regs(state, 0xae00, coeff_lut[i].val, ret = af9013_wr_regs(state, 0xae00, coeff_lut[i].val,
sizeof(coeff_lut[i].val)); sizeof(coeff_lut[i].val));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment