]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.1.13/si2168-bounds-check-firmware.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.1.13 / si2168-bounds-check-firmware.patch
1 From 47810b4341ac9d2f558894bc5995e6fa2a1298f9 Mon Sep 17 00:00:00 2001
2 From: Laura Abbott <labbott@fedoraproject.org>
3 Date: Tue, 29 Sep 2015 21:10:09 -0300
4 Subject: [media] si2168: Bounds check firmware
5
6 From: Laura Abbott <labbott@fedoraproject.org>
7
8 commit 47810b4341ac9d2f558894bc5995e6fa2a1298f9 upstream.
9
10 When reading the firmware and sending commands, the length must
11 be bounds checked to avoid overrunning the size of the command
12 buffer and smashing the stack if the firmware is not in the expected
13 format:
14
15 si2168 11-0064: found a 'Silicon Labs Si2168-B40'
16 si2168 11-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
17 si2168 11-0064: firmware download failed -95
18 Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffffa085708f
19
20 Add the proper check.
21
22 Reported-by: Stuart Auchterlonie <sauchter@redhat.com>
23 Reviewed-by: Antti Palosaari <crope@iki.fi>
24 Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
25 Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27
28 ---
29 drivers/media/dvb-frontends/si2168.c | 4 ++++
30 1 file changed, 4 insertions(+)
31
32 --- a/drivers/media/dvb-frontends/si2168.c
33 +++ b/drivers/media/dvb-frontends/si2168.c
34 @@ -457,6 +457,10 @@ static int si2168_init(struct dvb_fronte
35 /* firmware is in the new format */
36 for (remaining = fw->size; remaining > 0; remaining -= 17) {
37 len = fw->data[fw->size - remaining];
38 + if (len > SI2168_ARGLEN) {
39 + ret = -EINVAL;
40 + break;
41 + }
42 memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1], len);
43 cmd.wlen = len;
44 cmd.rlen = 1;