“dd5dc001581a7cf6f563e188c302caae1be998c2”上不存在“sound/git@gitcode.net:openanolis/cloud-kernel.git”
提交 2131d3c2 编写于 作者: P Pontus Fuchs 提交者: Luciano Coelho

wl12xx: Validate FEM index from ini file and FW

Check for out of bound FEM index to prevent reading beyond ini
memory end.
Signed-off-by: NPontus Fuchs <pontus.fuchs@gmail.com>
Cc: stable@kernel.org
Reviewed-by: NLuciano Coelho <coelho@ti.com>
Signed-off-by: NLuciano Coelho <coelho@ti.com>
上级 e4da3fbf
...@@ -121,6 +121,11 @@ int wl1271_cmd_general_parms(struct wl1271 *wl) ...@@ -121,6 +121,11 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)
if (!wl->nvs) if (!wl->nvs)
return -ENODEV; return -ENODEV;
if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
wl1271_warning("FEM index from INI out of bounds");
return -EINVAL;
}
gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
if (!gen_parms) if (!gen_parms)
return -ENOMEM; return -ENOMEM;
...@@ -144,6 +149,12 @@ int wl1271_cmd_general_parms(struct wl1271 *wl) ...@@ -144,6 +149,12 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)
gp->tx_bip_fem_manufacturer = gp->tx_bip_fem_manufacturer =
gen_parms->general_params.tx_bip_fem_manufacturer; gen_parms->general_params.tx_bip_fem_manufacturer;
if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
wl1271_warning("FEM index from FW out of bounds");
ret = -EINVAL;
goto out;
}
wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n", wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n",
answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer); answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer);
...@@ -163,6 +174,11 @@ int wl128x_cmd_general_parms(struct wl1271 *wl) ...@@ -163,6 +174,11 @@ int wl128x_cmd_general_parms(struct wl1271 *wl)
if (!wl->nvs) if (!wl->nvs)
return -ENODEV; return -ENODEV;
if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
wl1271_warning("FEM index from ini out of bounds");
return -EINVAL;
}
gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
if (!gen_parms) if (!gen_parms)
return -ENOMEM; return -ENOMEM;
...@@ -187,6 +203,12 @@ int wl128x_cmd_general_parms(struct wl1271 *wl) ...@@ -187,6 +203,12 @@ int wl128x_cmd_general_parms(struct wl1271 *wl)
gp->tx_bip_fem_manufacturer = gp->tx_bip_fem_manufacturer =
gen_parms->general_params.tx_bip_fem_manufacturer; gen_parms->general_params.tx_bip_fem_manufacturer;
if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
wl1271_warning("FEM index from FW out of bounds");
ret = -EINVAL;
goto out;
}
wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n", wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n",
answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer); answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册