aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/debugfs.c')
-rw-r--r--drivers/net/wireless/libertas/debugfs.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index d3a47cc95475..b0a76c5bec66 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -293,18 +293,23 @@ static ssize_t lbs_setuserscan(struct file *file,
293 struct lbs_ioctl_user_scan_cfg *scan_cfg; 293 struct lbs_ioctl_user_scan_cfg *scan_cfg;
294 union iwreq_data wrqu; 294 union iwreq_data wrqu;
295 int dur; 295 int dur;
296 unsigned long addr = get_zeroed_page(GFP_KERNEL); 296 char *buf = (char *)get_zeroed_page(GFP_KERNEL);
297 char *buf = (char *)addr;
298 297
299 scan_cfg = kzalloc(sizeof(struct lbs_ioctl_user_scan_cfg), GFP_KERNEL); 298 if (!buf)
300 if (!scan_cfg)
301 return -ENOMEM; 299 return -ENOMEM;
302 300
303 buf_size = min(count, len - 1); 301 buf_size = min(count, len - 1);
304 if (copy_from_user(buf, userbuf, buf_size)) { 302 if (copy_from_user(buf, userbuf, buf_size)) {
305 res = -EFAULT; 303 res = -EFAULT;
306 goto out_unlock; 304 goto out_buf;
305 }
306
307 scan_cfg = kzalloc(sizeof(struct lbs_ioctl_user_scan_cfg), GFP_KERNEL);
308 if (!scan_cfg) {
309 res = -ENOMEM;
310 goto out_buf;
307 } 311 }
312 res = count;
308 313
309 scan_cfg->bsstype = LBS_SCAN_BSS_TYPE_ANY; 314 scan_cfg->bsstype = LBS_SCAN_BSS_TYPE_ANY;
310 315
@@ -317,15 +322,19 @@ static ssize_t lbs_setuserscan(struct file *file,
317 322
318 lbs_scan_networks(priv, scan_cfg, 1); 323 lbs_scan_networks(priv, scan_cfg, 1);
319 wait_event_interruptible(priv->adapter->cmd_pending, 324 wait_event_interruptible(priv->adapter->cmd_pending,
320 !priv->adapter->nr_cmd_pending); 325 priv->adapter->surpriseremoved || !priv->adapter->nr_cmd_pending);
326
327 if (priv->adapter->surpriseremoved)
328 goto out_scan_cfg;
321 329
322 memset(&wrqu, 0x00, sizeof(union iwreq_data)); 330 memset(&wrqu, 0x00, sizeof(union iwreq_data));
323 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); 331 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
324 332
325out_unlock: 333 out_scan_cfg:
326 free_page(addr);
327 kfree(scan_cfg); 334 kfree(scan_cfg);
328 return count; 335 out_buf:
336 free_page((unsigned long)buf);
337 return res;
329} 338}
330 339
331 340