aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPontus Fuchs <pontus.fuchs@gmail.com>2011-10-18 03:23:41 -0400
committerLuciano Coelho <coelho@ti.com>2011-12-01 08:55:42 -0500
commit2131d3c2f99b081806fdae7662c92fe6acda52af (patch)
tree8250d3c6a0062f9561dbaefa0c30bb3ea2247f7f
parente4da3fbfbd1de56d2367653e3823e6445e49f8a9 (diff)
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: Pontus Fuchs <pontus.fuchs@gmail.com> Cc: stable@kernel.org Reviewed-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r--drivers/net/wireless/wl12xx/cmd.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c
index afd597387e7..e0d21797948 100644
--- a/drivers/net/wireless/wl12xx/cmd.c
+++ b/drivers/net/wireless/wl12xx/cmd.c
@@ -121,6 +121,11 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)
121 if (!wl->nvs) 121 if (!wl->nvs)
122 return -ENODEV; 122 return -ENODEV;
123 123
124 if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
125 wl1271_warning("FEM index from INI out of bounds");
126 return -EINVAL;
127 }
128
124 gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); 129 gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
125 if (!gen_parms) 130 if (!gen_parms)
126 return -ENOMEM; 131 return -ENOMEM;
@@ -144,6 +149,12 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)
144 gp->tx_bip_fem_manufacturer = 149 gp->tx_bip_fem_manufacturer =
145 gen_parms->general_params.tx_bip_fem_manufacturer; 150 gen_parms->general_params.tx_bip_fem_manufacturer;
146 151
152 if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
153 wl1271_warning("FEM index from FW out of bounds");
154 ret = -EINVAL;
155 goto out;
156 }
157
147 wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n", 158 wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n",
148 answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer); 159 answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer);
149 160
@@ -163,6 +174,11 @@ int wl128x_cmd_general_parms(struct wl1271 *wl)
163 if (!wl->nvs) 174 if (!wl->nvs)
164 return -ENODEV; 175 return -ENODEV;
165 176
177 if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
178 wl1271_warning("FEM index from ini out of bounds");
179 return -EINVAL;
180 }
181
166 gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); 182 gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
167 if (!gen_parms) 183 if (!gen_parms)
168 return -ENOMEM; 184 return -ENOMEM;
@@ -187,6 +203,12 @@ int wl128x_cmd_general_parms(struct wl1271 *wl)
187 gp->tx_bip_fem_manufacturer = 203 gp->tx_bip_fem_manufacturer =
188 gen_parms->general_params.tx_bip_fem_manufacturer; 204 gen_parms->general_params.tx_bip_fem_manufacturer;
189 205
206 if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
207 wl1271_warning("FEM index from FW out of bounds");
208 ret = -EINVAL;
209 goto out;
210 }
211
190 wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n", 212 wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n",
191 answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer); 213 answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer);
192 214