From: Mauro Carvalho Chehab Date: Tue, 28 Apr 2015 22:02:19 +0000 (-0300) Subject: af9013: Don't accept invalid bandwidth X-Git-Tag: v4.1.4~202 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=16eeb2182fb8f31a91e831f6f1ead91f373df4f6;p=users%2Fjedix%2Flinux-maple.git af9013: Don't accept invalid bandwidth commit d7b76c91f471413de9ded837bddeca2164786571 upstream. 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. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/media/dvb-frontends/af9013.c b/drivers/media/dvb-frontends/af9013.c index 8001690d7576..ba6c8f6c42a1 100644 --- a/drivers/media/dvb-frontends/af9013.c +++ b/drivers/media/dvb-frontends/af9013.c @@ -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, sizeof(coeff_lut[i].val)); }