From: Mauro Carvalho Chehab Date: Wed, 16 Jun 2021 11:02:07 +0000 (+0200) Subject: media: dvb_ca_en50221: avoid speculation from CA slot X-Git-Tag: v5.15~623^2~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d382c5be4cc24597d5d12800558e537bbc12a71a;p=platform%2Fkernel%2Flinux-starfive.git media: dvb_ca_en50221: avoid speculation from CA slot As warned by smatch: drivers/media/dvb-core/dvb_ca_en50221.c:1392 dvb_ca_en50221_io_do_ioctl() warn: potential spectre issue 'ca->slot_info' [r] (local cap) There's a potential of using a CAM ioctl for speculation. The risk here is minimum, as only a small subset of DVB boards have CI, with a CAM module installed. Also, exploiting it would require a user capable of starting a DVB application. There are probably a lot of easier ways to try to exploit. Yet, it doesn't harm addressing it. Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c index b7e4a33..15a08d8 100644 --- a/drivers/media/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb-core/dvb_ca_en50221.c @@ -1386,6 +1386,7 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file, err = -EINVAL; goto out_unlock; } + slot = array_index_nospec(slot, ca->slot_count); info->type = CA_CI_LINK; info->flags = 0;