Skip to content

Commit 62a7200

Browse files
WainDingasus-leslieyu
authored andcommitted
video: rockchip: vcodec: fix risk for session->type overflow
bug relative serial number: CNVD-C-2020-193874 Change-Id: I0862d1d43a2cd6be1ee51da5c1f22228e5ec074b Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
1 parent bda7005 commit 62a7200

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/video/rockchip/vcodec/vcodec_service.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include <linux/pm_opp.h>
4444
#include <linux/pm_runtime.h>
4545
#include <linux/iopoll.h>
46+
#include <linux/nospec.h>
4647

4748
#include <linux/regulator/consumer.h>
4849
#include <linux/rockchip/grf.h>
@@ -1454,6 +1455,8 @@ static struct vpu_reg *reg_init(struct vpu_subdev_data *data,
14541455
extra_size = size - data->reg_size;
14551456
size = data->reg_size;
14561457
}
1458+
session->type = array_index_nospec(session->type, VPU_TYPE_BUTT);
1459+
14571460
reg->session = session;
14581461
reg->data = data;
14591462
reg->type = session->type;

0 commit comments

Comments
 (0)