From: fengsheng fengsheng5@huawei.com
driver inclusion category: Bugfix bugzilla: NA CVE: NA
1. the variable : sysctl_subctrl_tdh_priv[chip_id] add legitimacy check. 2. the param of sysctl_tdh_mem_access_open: chip_id add legitimacy check.
Signed-off-by: fengsheng fengsheng5@huawei.com Reviewed-by: zhangmu zhangmu1@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/soc/hisilicon/sysctl/sysctl_drv.c | 2 +- drivers/soc/hisilicon/sysctl/sysctl_local_ras.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/hisilicon/sysctl/sysctl_drv.c b/drivers/soc/hisilicon/sysctl/sysctl_drv.c index 8bb6a9f..660d15a 100644 --- a/drivers/soc/hisilicon/sysctl/sysctl_drv.c +++ b/drivers/soc/hisilicon/sysctl/sysctl_drv.c @@ -48,7 +48,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define DEBUG
-#define SYSCTL_DRIVER_VERSION "1.9.32.0" +#define SYSCTL_DRIVER_VERSION "1.9.38.0"
unsigned int g_sysctrl_debug;
diff --git a/drivers/soc/hisilicon/sysctl/sysctl_local_ras.c b/drivers/soc/hisilicon/sysctl/sysctl_local_ras.c index d09ab42..0ad5756 100644 --- a/drivers/soc/hisilicon/sysctl/sysctl_local_ras.c +++ b/drivers/soc/hisilicon/sysctl/sysctl_local_ras.c @@ -90,6 +90,9 @@ static int sysctl_tdh_reset(u8 chip_id) return SYSCTL_ERR_PARAM; }
+ if (!sysctl_subctrl_tdh_priv[chip_id]) + return SYSCTL_ERR_PARAM; + addr = sysctl_subctrl_tdh_priv[chip_id] + SUBCTRL_TDH_RESET_OFFSET; writel(0x3, addr);
@@ -105,6 +108,9 @@ static int sysctl_tdh_unreset(u8 chip_id) return SYSCTL_ERR_PARAM; }
+ if (!sysctl_subctrl_tdh_priv[chip_id]) + return SYSCTL_ERR_PARAM; + addr = sysctl_subctrl_tdh_priv[chip_id] + SUBCTRL_TDH_UNRESET_OFFSET; writel(0x3, addr);
@@ -115,6 +121,11 @@ static int sysctl_tdh_mem_access_open(u8 chip_id) { void __iomem *addr;
+ if (chip_id >= CHIP_ID_NUM_MAX) { + pr_err("err chip id %u %s\n", chip_id, __func__); + return SYSCTL_ERR_PARAM; + } + if (!sysctl_tdh_priv[chip_id]) return SYSCTL_ERR_PARAM;