Commit 9f4c6518 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Kleber Sacilotto de Souza

media: dvb_ca_en50221: prevent using slot_info for Spectre attacs

slot can be controlled by user-space, hence leading to
a potential exploitation of the Spectre variant 1 vulnerability,
as warned by smatch:
	drivers/media/dvb-core/dvb_ca_en50221.c:1479 dvb_ca_en50221_io_write() warn: potential spectre issue 'ca->slot_info' (local cap)
Acked-by: default avatar"Jasmin J." <jasmin@anw.at>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>

CVE-2017-5753

(backported from commit 4f5ab5d7)
[juergh:
 - Adjusted context.
 - Folded in a24e6348 ("media: dvb_ca_en50221: sanity check slot number from userspace").]
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Acked-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 8dd710f1
......@@ -32,6 +32,7 @@
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/nospec.h>
#include <linux/vmalloc.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
......@@ -1333,6 +1334,10 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file,
buf += 2;
count -= 2;
if (slot >= ca->slot_count)
return -EINVAL;
slot = array_index_nospec(slot, ca->slot_count);
/* check if the slot is actually running */
if (ca->slot_info[slot].slot_state != DVB_CA_SLOTSTATE_RUNNING)
return -EINVAL;
......
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