Commit 0f43dd546d991ca260d8a72d07f617907c508de8

Authored by Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (42 commits)
  netpoll: fix incorrect access to skb data in __netpoll_rx
  cassini: init before use in cas_interruptN.
  can: ti_hecc: Fix uninitialized spinlock in probe
  can: ti_hecc: Fix unintialized variable
  net: sh_eth: fix the compile error
  net/phy: fix DP83865 phy interrupt handler
  sendmmsg/sendmsg: fix unsafe user pointer access
  ibmveth: Fix leak when recycling skb and hypervisor returns error
  arp: fix rcu lockdep splat in arp_process()
  bridge: fix a possible use after free
  bridge: Pseudo-header required for the checksum of ICMPv6
  mcast: Fix source address selection for multicast listener report
  MAINTAINERS: Update GIT trees for network development
  ath9k: Fix PS wrappers in ath9k_set_coverage_class
  carl9170: Fix mismatch in carl9170_op_set_key mutex lock-unlock
  wl12xx: add max_sched_scan_ssids value to the hw description
  wl12xx: Fix validation of pm_runtime_get_sync return value
  wl12xx: Remove obsolete testmode NVS push command
  bcma: add uevent to the bus, to autoload drivers
  ath9k_hw: Fix STA (AR9485) bringup issue due to incorrect MAC address
  ...

Showing 39 changed files Side-by-side Diff

... ... @@ -4450,8 +4450,8 @@
4450 4450 L: netdev@vger.kernel.org
4451 4451 W: http://www.linuxfoundation.org/en/Net
4452 4452 W: http://patchwork.ozlabs.org/project/netdev/list/
4453   -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
4454   -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git
  4453 +T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
  4454 +T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
4455 4455 S: Maintained
4456 4456 F: net/
4457 4457 F: include/net/
... ... @@ -15,6 +15,7 @@
15 15 static int bcma_bus_match(struct device *dev, struct device_driver *drv);
16 16 static int bcma_device_probe(struct device *dev);
17 17 static int bcma_device_remove(struct device *dev);
  18 +static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *env);
18 19  
19 20 static ssize_t manuf_show(struct device *dev, struct device_attribute *attr, char *buf)
20 21 {
... ... @@ -49,6 +50,7 @@
49 50 .match = bcma_bus_match,
50 51 .probe = bcma_device_probe,
51 52 .remove = bcma_device_remove,
  53 + .uevent = bcma_device_uevent,
52 54 .dev_attrs = bcma_device_attrs,
53 55 };
54 56  
... ... @@ -225,6 +227,16 @@
225 227 adrv->remove(core);
226 228  
227 229 return 0;
  230 +}
  231 +
  232 +static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *env)
  233 +{
  234 + struct bcma_device *core = container_of(dev, struct bcma_device, dev);
  235 +
  236 + return add_uevent_var(env,
  237 + "MODALIAS=bcma:m%04Xid%04Xrev%02Xcl%02X",
  238 + core->id.manuf, core->id.id,
  239 + core->id.rev, core->id.class);
228 240 }
229 241  
230 242 static int __init bcma_modinit(void)
drivers/bluetooth/ath3k.c
... ... @@ -63,6 +63,7 @@
63 63 /* Atheros AR3011 with sflash firmware*/
64 64 { USB_DEVICE(0x0CF3, 0x3002) },
65 65 { USB_DEVICE(0x13d3, 0x3304) },
  66 + { USB_DEVICE(0x0930, 0x0215) },
66 67  
67 68 /* Atheros AR9285 Malbec with sflash firmware */
68 69 { USB_DEVICE(0x03F0, 0x311D) },
drivers/bluetooth/btusb.c
... ... @@ -106,6 +106,7 @@
106 106 /* Atheros 3011 with sflash firmware */
107 107 { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE },
108 108 { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE },
  109 + { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE },
109 110  
110 111 /* Atheros AR9285 Malbec with sflash firmware */
111 112 { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE },
... ... @@ -256,7 +257,9 @@
256 257  
257 258 err = usb_submit_urb(urb, GFP_ATOMIC);
258 259 if (err < 0) {
259   - if (err != -EPERM)
  260 + /* -EPERM: urb is being killed;
  261 + * -ENODEV: device got disconnected */
  262 + if (err != -EPERM && err != -ENODEV)
260 263 BT_ERR("%s urb %p failed to resubmit (%d)",
261 264 hdev->name, urb, -err);
262 265 usb_unanchor_urb(urb);
... ... @@ -341,7 +344,9 @@
341 344  
342 345 err = usb_submit_urb(urb, GFP_ATOMIC);
343 346 if (err < 0) {
344   - if (err != -EPERM)
  347 + /* -EPERM: urb is being killed;
  348 + * -ENODEV: device got disconnected */
  349 + if (err != -EPERM && err != -ENODEV)
345 350 BT_ERR("%s urb %p failed to resubmit (%d)",
346 351 hdev->name, urb, -err);
347 352 usb_unanchor_urb(urb);
... ... @@ -431,7 +436,9 @@
431 436  
432 437 err = usb_submit_urb(urb, GFP_ATOMIC);
433 438 if (err < 0) {
434   - if (err != -EPERM)
  439 + /* -EPERM: urb is being killed;
  440 + * -ENODEV: device got disconnected */
  441 + if (err != -EPERM && err != -ENODEV)
435 442 BT_ERR("%s urb %p failed to resubmit (%d)",
436 443 hdev->name, urb, -err);
437 444 usb_unanchor_urb(urb);
drivers/net/can/ti_hecc.c
... ... @@ -503,9 +503,9 @@
503 503 spin_unlock_irqrestore(&priv->mbx_lock, flags);
504 504  
505 505 /* Prepare mailbox for transmission */
  506 + data = cf->can_dlc | (get_tx_head_prio(priv) << 8);
506 507 if (cf->can_id & CAN_RTR_FLAG) /* Remote transmission request */
507 508 data |= HECC_CANMCF_RTR;
508   - data |= get_tx_head_prio(priv) << 8;
509 509 hecc_write_mbx(priv, mbxno, HECC_CANMCF, data);
510 510  
511 511 if (cf->can_id & CAN_EFF_FLAG) /* Extended frame format */
... ... @@ -923,6 +923,7 @@
923 923 priv->can.do_get_state = ti_hecc_get_state;
924 924 priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
925 925  
  926 + spin_lock_init(&priv->mbx_lock);
926 927 ndev->irq = irq->start;
927 928 ndev->flags |= IFF_ECHO;
928 929 platform_set_drvdata(pdev, ndev);
drivers/net/cassini.c
... ... @@ -2452,14 +2452,13 @@
2452 2452 struct net_device *dev = dev_id;
2453 2453 struct cas *cp = netdev_priv(dev);
2454 2454 unsigned long flags;
2455   - int ring;
  2455 + int ring = (irq == cp->pci_irq_INTC) ? 2 : 3;
2456 2456 u32 status = readl(cp->regs + REG_PLUS_INTRN_STATUS(ring));
2457 2457  
2458 2458 /* check for shared irq */
2459 2459 if (status == 0)
2460 2460 return IRQ_NONE;
2461 2461  
2462   - ring = (irq == cp->pci_irq_INTC) ? 2 : 3;
2463 2462 spin_lock_irqsave(&cp->lock, flags);
2464 2463 if (status & INTR_RX_DONE_ALT) { /* handle rx separately */
2465 2464 #ifdef USE_NAPI
drivers/net/ibmveth.c
... ... @@ -395,7 +395,7 @@
395 395 }
396 396  
397 397 /* recycle the current buffer on the rx queue */
398   -static void ibmveth_rxq_recycle_buffer(struct ibmveth_adapter *adapter)
  398 +static int ibmveth_rxq_recycle_buffer(struct ibmveth_adapter *adapter)
399 399 {
400 400 u32 q_index = adapter->rx_queue.index;
401 401 u64 correlator = adapter->rx_queue.queue_addr[q_index].correlator;
... ... @@ -403,6 +403,7 @@
403 403 unsigned int index = correlator & 0xffffffffUL;
404 404 union ibmveth_buf_desc desc;
405 405 unsigned long lpar_rc;
  406 + int ret = 1;
406 407  
407 408 BUG_ON(pool >= IBMVETH_NUM_BUFF_POOLS);
408 409 BUG_ON(index >= adapter->rx_buff_pool[pool].size);
... ... @@ -410,7 +411,7 @@
410 411 if (!adapter->rx_buff_pool[pool].active) {
411 412 ibmveth_rxq_harvest_buffer(adapter);
412 413 ibmveth_free_buffer_pool(adapter, &adapter->rx_buff_pool[pool]);
413   - return;
  414 + goto out;
414 415 }
415 416  
416 417 desc.fields.flags_len = IBMVETH_BUF_VALID |
417 418  
... ... @@ -423,12 +424,16 @@
423 424 netdev_dbg(adapter->netdev, "h_add_logical_lan_buffer failed "
424 425 "during recycle rc=%ld", lpar_rc);
425 426 ibmveth_remove_buffer_from_pool(adapter, adapter->rx_queue.queue_addr[adapter->rx_queue.index].correlator);
  427 + ret = 0;
426 428 }
427 429  
428 430 if (++adapter->rx_queue.index == adapter->rx_queue.num_slots) {
429 431 adapter->rx_queue.index = 0;
430 432 adapter->rx_queue.toggle = !adapter->rx_queue.toggle;
431 433 }
  434 +
  435 +out:
  436 + return ret;
432 437 }
433 438  
434 439 static void ibmveth_rxq_harvest_buffer(struct ibmveth_adapter *adapter)
435 440  
... ... @@ -1084,8 +1089,9 @@
1084 1089 if (rx_flush)
1085 1090 ibmveth_flush_buffer(skb->data,
1086 1091 length + offset);
  1092 + if (!ibmveth_rxq_recycle_buffer(adapter))
  1093 + kfree_skb(skb);
1087 1094 skb = new_skb;
1088   - ibmveth_rxq_recycle_buffer(adapter);
1089 1095 } else {
1090 1096 ibmveth_rxq_harvest_buffer(adapter);
1091 1097 skb_reserve(skb, offset);
drivers/net/phy/national.c
... ... @@ -25,8 +25,9 @@
25 25 /* DP83865 phy identifier values */
26 26 #define DP83865_PHY_ID 0x20005c7a
27 27  
28   -#define DP83865_INT_MASK_REG 0x15
29   -#define DP83865_INT_MASK_STATUS 0x14
  28 +#define DP83865_INT_STATUS 0x14
  29 +#define DP83865_INT_MASK 0x15
  30 +#define DP83865_INT_CLEAR 0x17
30 31  
31 32 #define DP83865_INT_REMOTE_FAULT 0x0008
32 33 #define DP83865_INT_ANE_COMPLETED 0x0010
33 34  
34 35  
35 36  
... ... @@ -68,21 +69,25 @@
68 69 int err;
69 70  
70 71 if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
71   - err = phy_write(phydev, DP83865_INT_MASK_REG,
  72 + err = phy_write(phydev, DP83865_INT_MASK,
72 73 DP83865_INT_MASK_DEFAULT);
73 74 else
74   - err = phy_write(phydev, DP83865_INT_MASK_REG, 0);
  75 + err = phy_write(phydev, DP83865_INT_MASK, 0);
75 76  
76 77 return err;
77 78 }
78 79  
79 80 static int ns_ack_interrupt(struct phy_device *phydev)
80 81 {
81   - int ret = phy_read(phydev, DP83865_INT_MASK_STATUS);
  82 + int ret = phy_read(phydev, DP83865_INT_STATUS);
82 83 if (ret < 0)
83 84 return ret;
84 85  
85   - return 0;
  86 + /* Clear the interrupt status bit by writing a โ€œ1โ€
  87 + * to the corresponding bit in INT_CLEAR (2:0 are reserved) */
  88 + ret = phy_write(phydev, DP83865_INT_CLEAR, ret & ~0x7);
  89 +
  90 + return ret;
86 91 }
87 92  
88 93 static void ns_giga_speed_fallback(struct phy_device *phydev, int mode)
drivers/net/sh_eth.c
... ... @@ -31,6 +31,7 @@
31 31 #include <linux/phy.h>
32 32 #include <linux/cache.h>
33 33 #include <linux/io.h>
  34 +#include <linux/interrupt.h>
34 35 #include <linux/pm_runtime.h>
35 36 #include <linux/slab.h>
36 37 #include <linux/ethtool.h>
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
... ... @@ -69,7 +69,7 @@
69 69 static const struct ar9300_eeprom ar9300_default = {
70 70 .eepromVersion = 2,
71 71 .templateVersion = 2,
72   - .macAddr = {1, 2, 3, 4, 5, 6},
  72 + .macAddr = {0, 2, 3, 4, 5, 6},
73 73 .custData = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
74 74 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
75 75 .baseEepHeader = {
drivers/net/wireless/ath/ath9k/main.c
... ... @@ -2283,7 +2283,11 @@
2283 2283  
2284 2284 mutex_lock(&sc->mutex);
2285 2285 ah->coverage_class = coverage_class;
  2286 +
  2287 + ath9k_ps_wakeup(sc);
2286 2288 ath9k_hw_init_global_settings(ah);
  2289 + ath9k_ps_restore(sc);
  2290 +
2287 2291 mutex_unlock(&sc->mutex);
2288 2292 }
2289 2293  
drivers/net/wireless/ath/carl9170/main.c
... ... @@ -1066,8 +1066,10 @@
1066 1066 * the high througput speed in 802.11n networks.
1067 1067 */
1068 1068  
1069   - if (!is_main_vif(ar, vif))
  1069 + if (!is_main_vif(ar, vif)) {
  1070 + mutex_lock(&ar->mutex);
1070 1071 goto err_softw;
  1072 + }
1071 1073  
1072 1074 /*
1073 1075 * While the hardware supports *catch-all* key, for offloading
drivers/net/wireless/rt2x00/rt2x00usb.c
... ... @@ -871,18 +871,8 @@
871 871 {
872 872 struct ieee80211_hw *hw = usb_get_intfdata(usb_intf);
873 873 struct rt2x00_dev *rt2x00dev = hw->priv;
874   - int retval;
875 874  
876   - retval = rt2x00lib_suspend(rt2x00dev, state);
877   - if (retval)
878   - return retval;
879   -
880   - /*
881   - * Decrease usbdev refcount.
882   - */
883   - usb_put_dev(interface_to_usbdev(usb_intf));
884   -
885   - return 0;
  875 + return rt2x00lib_suspend(rt2x00dev, state);
886 876 }
887 877 EXPORT_SYMBOL_GPL(rt2x00usb_suspend);
888 878  
... ... @@ -890,8 +880,6 @@
890 880 {
891 881 struct ieee80211_hw *hw = usb_get_intfdata(usb_intf);
892 882 struct rt2x00_dev *rt2x00dev = hw->priv;
893   -
894   - usb_get_dev(interface_to_usbdev(usb_intf));
895 883  
896 884 return rt2x00lib_resume(rt2x00dev);
897 885 }
drivers/net/wireless/wl12xx/main.c
... ... @@ -4283,6 +4283,7 @@
4283 4283 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
4284 4284 BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP);
4285 4285 wl->hw->wiphy->max_scan_ssids = 1;
  4286 + wl->hw->wiphy->max_sched_scan_ssids = 1;
4286 4287 /*
4287 4288 * Maximum length of elements in scanning probe request templates
4288 4289 * should be the maximum length possible for a template, without
drivers/net/wireless/wl12xx/sdio.c
... ... @@ -164,7 +164,7 @@
164 164 /* If enabled, tell runtime PM not to power off the card */
165 165 if (pm_runtime_enabled(&func->dev)) {
166 166 ret = pm_runtime_get_sync(&func->dev);
167   - if (ret)
  167 + if (ret < 0)
168 168 goto out;
169 169 } else {
170 170 /* Runtime PM is disabled: power up the card manually */
drivers/net/wireless/wl12xx/testmode.c
... ... @@ -36,7 +36,6 @@
36 36 WL1271_TM_CMD_TEST,
37 37 WL1271_TM_CMD_INTERROGATE,
38 38 WL1271_TM_CMD_CONFIGURE,
39   - WL1271_TM_CMD_NVS_PUSH,
40 39 WL1271_TM_CMD_SET_PLT_MODE,
41 40 WL1271_TM_CMD_RECOVER,
42 41  
... ... @@ -190,48 +189,6 @@
190 189 return 0;
191 190 }
192 191  
193   -static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[])
194   -{
195   - int ret = 0;
196   - size_t len;
197   - void *buf;
198   -
199   - wl1271_debug(DEBUG_TESTMODE, "testmode cmd nvs push");
200   -
201   - if (!tb[WL1271_TM_ATTR_DATA])
202   - return -EINVAL;
203   -
204   - buf = nla_data(tb[WL1271_TM_ATTR_DATA]);
205   - len = nla_len(tb[WL1271_TM_ATTR_DATA]);
206   -
207   - mutex_lock(&wl->mutex);
208   -
209   - kfree(wl->nvs);
210   -
211   - if ((wl->chip.id == CHIP_ID_1283_PG20) &&
212   - (len != sizeof(struct wl128x_nvs_file)))
213   - return -EINVAL;
214   - else if (len != sizeof(struct wl1271_nvs_file))
215   - return -EINVAL;
216   -
217   - wl->nvs = kzalloc(len, GFP_KERNEL);
218   - if (!wl->nvs) {
219   - wl1271_error("could not allocate memory for the nvs file");
220   - ret = -ENOMEM;
221   - goto out;
222   - }
223   -
224   - memcpy(wl->nvs, buf, len);
225   - wl->nvs_len = len;
226   -
227   - wl1271_debug(DEBUG_TESTMODE, "testmode pushed nvs");
228   -
229   -out:
230   - mutex_unlock(&wl->mutex);
231   -
232   - return ret;
233   -}
234   -
235 192 static int wl1271_tm_cmd_set_plt_mode(struct wl1271 *wl, struct nlattr *tb[])
236 193 {
237 194 u32 val;
... ... @@ -288,8 +245,6 @@
288 245 return wl1271_tm_cmd_interrogate(wl, tb);
289 246 case WL1271_TM_CMD_CONFIGURE:
290 247 return wl1271_tm_cmd_configure(wl, tb);
291   - case WL1271_TM_CMD_NVS_PUSH:
292   - return wl1271_tm_cmd_nvs_push(wl, tb);
293 248 case WL1271_TM_CMD_SET_PLT_MODE:
294 249 return wl1271_tm_cmd_set_plt_mode(wl, tb);
295 250 case WL1271_TM_CMD_RECOVER:
include/net/cfg80211.h
... ... @@ -1865,6 +1865,9 @@
1865 1865 * you need use set_wiphy_dev() (see below) */
1866 1866 struct device dev;
1867 1867  
  1868 + /* protects ->resume, ->suspend sysfs callbacks against unregister hw */
  1869 + bool registered;
  1870 +
1868 1871 /* dir in debugfs: ieee80211/<wiphyname> */
1869 1872 struct dentry *debugfsdir;
1870 1873  
net/bluetooth/af_bluetooth.c
... ... @@ -494,9 +494,8 @@
494 494 BT_DBG("sk %p", sk);
495 495  
496 496 add_wait_queue(sk_sleep(sk), &wait);
  497 + set_current_state(TASK_INTERRUPTIBLE);
497 498 while (sk->sk_state != state) {
498   - set_current_state(TASK_INTERRUPTIBLE);
499   -
500 499 if (!timeo) {
501 500 err = -EINPROGRESS;
502 501 break;
503 502  
... ... @@ -510,12 +509,13 @@
510 509 release_sock(sk);
511 510 timeo = schedule_timeout(timeo);
512 511 lock_sock(sk);
  512 + set_current_state(TASK_INTERRUPTIBLE);
513 513  
514 514 err = sock_error(sk);
515 515 if (err)
516 516 break;
517 517 }
518   - set_current_state(TASK_RUNNING);
  518 + __set_current_state(TASK_RUNNING);
519 519 remove_wait_queue(sk_sleep(sk), &wait);
520 520 return err;
521 521 }
net/bluetooth/bnep/bnep.h
... ... @@ -155,6 +155,7 @@
155 155 unsigned int role;
156 156 unsigned long state;
157 157 unsigned long flags;
  158 + atomic_t terminate;
158 159 struct task_struct *task;
159 160  
160 161 struct ethhdr eh;
net/bluetooth/bnep/core.c
... ... @@ -484,9 +484,11 @@
484 484  
485 485 init_waitqueue_entry(&wait, current);
486 486 add_wait_queue(sk_sleep(sk), &wait);
487   - while (!kthread_should_stop()) {
  487 + while (1) {
488 488 set_current_state(TASK_INTERRUPTIBLE);
489 489  
  490 + if (atomic_read(&s->terminate))
  491 + break;
490 492 /* RX */
491 493 while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
492 494 skb_orphan(skb);
... ... @@ -504,7 +506,7 @@
504 506  
505 507 schedule();
506 508 }
507   - set_current_state(TASK_RUNNING);
  509 + __set_current_state(TASK_RUNNING);
508 510 remove_wait_queue(sk_sleep(sk), &wait);
509 511  
510 512 /* Cleanup session */
... ... @@ -640,9 +642,10 @@
640 642 down_read(&bnep_session_sem);
641 643  
642 644 s = __bnep_get_session(req->dst);
643   - if (s)
644   - kthread_stop(s->task);
645   - else
  645 + if (s) {
  646 + atomic_inc(&s->terminate);
  647 + wake_up_process(s->task);
  648 + } else
646 649 err = -ENOENT;
647 650  
648 651 up_read(&bnep_session_sem);
net/bluetooth/cmtp/capi.c
... ... @@ -386,7 +386,8 @@
386 386  
387 387 capi_ctr_down(ctrl);
388 388  
389   - kthread_stop(session->task);
  389 + atomic_inc(&session->terminate);
  390 + wake_up_process(session->task);
390 391 }
391 392  
392 393 static void cmtp_register_appl(struct capi_ctr *ctrl, __u16 appl, capi_register_params *rp)
net/bluetooth/cmtp/cmtp.h
... ... @@ -81,6 +81,7 @@
81 81  
82 82 char name[BTNAMSIZ];
83 83  
  84 + atomic_t terminate;
84 85 struct task_struct *task;
85 86  
86 87 wait_queue_head_t wait;
net/bluetooth/cmtp/core.c
... ... @@ -292,9 +292,11 @@
292 292  
293 293 init_waitqueue_entry(&wait, current);
294 294 add_wait_queue(sk_sleep(sk), &wait);
295   - while (!kthread_should_stop()) {
  295 + while (1) {
296 296 set_current_state(TASK_INTERRUPTIBLE);
297 297  
  298 + if (atomic_read(&session->terminate))
  299 + break;
298 300 if (sk->sk_state != BT_CONNECTED)
299 301 break;
300 302  
... ... @@ -307,7 +309,7 @@
307 309  
308 310 schedule();
309 311 }
310   - set_current_state(TASK_RUNNING);
  312 + __set_current_state(TASK_RUNNING);
311 313 remove_wait_queue(sk_sleep(sk), &wait);
312 314  
313 315 down_write(&cmtp_session_sem);
314 316  
... ... @@ -380,16 +382,17 @@
380 382  
381 383 if (!(session->flags & (1 << CMTP_LOOPBACK))) {
382 384 err = cmtp_attach_device(session);
383   - if (err < 0)
384   - goto detach;
  385 + if (err < 0) {
  386 + atomic_inc(&session->terminate);
  387 + wake_up_process(session->task);
  388 + up_write(&cmtp_session_sem);
  389 + return err;
  390 + }
385 391 }
386 392  
387 393 up_write(&cmtp_session_sem);
388 394 return 0;
389 395  
390   -detach:
391   - cmtp_detach_device(session);
392   -
393 396 unlink:
394 397 __cmtp_unlink_session(session);
395 398  
... ... @@ -414,7 +417,8 @@
414 417 skb_queue_purge(&session->transmit);
415 418  
416 419 /* Stop session thread */
417   - kthread_stop(session->task);
  420 + atomic_inc(&session->terminate);
  421 + wake_up_process(session->task);
418 422 } else
419 423 err = -ENOENT;
420 424  
net/bluetooth/hci_core.c
... ... @@ -1209,7 +1209,6 @@
1209 1209  
1210 1210 BT_ERR("%s command tx timeout", hdev->name);
1211 1211 atomic_set(&hdev->cmd_cnt, 1);
1212   - clear_bit(HCI_RESET, &hdev->flags);
1213 1212 tasklet_schedule(&hdev->cmd_task);
1214 1213 }
1215 1214  
... ... @@ -1327,7 +1326,7 @@
1327 1326  
1328 1327 entry = kzalloc(sizeof(struct bdaddr_list), GFP_KERNEL);
1329 1328 if (!entry) {
1330   - return -ENOMEM;
  1329 + err = -ENOMEM;
1331 1330 goto err;
1332 1331 }
1333 1332  
... ... @@ -2408,7 +2407,10 @@
2408 2407 if (hdev->sent_cmd) {
2409 2408 atomic_dec(&hdev->cmd_cnt);
2410 2409 hci_send_frame(skb);
2411   - mod_timer(&hdev->cmd_timer,
  2410 + if (test_bit(HCI_RESET, &hdev->flags))
  2411 + del_timer(&hdev->cmd_timer);
  2412 + else
  2413 + mod_timer(&hdev->cmd_timer,
2412 2414 jiffies + msecs_to_jiffies(HCI_CMD_TIMEOUT));
2413 2415 } else {
2414 2416 skb_queue_head(&hdev->cmd_q, skb);
net/bluetooth/hidp/core.c
... ... @@ -764,6 +764,7 @@
764 764  
765 765 up_write(&hidp_session_sem);
766 766  
  767 + kfree(session->rd_data);
767 768 kfree(session);
768 769 return 0;
769 770 }
... ... @@ -841,7 +842,8 @@
841 842  
842 843 err = input_register_device(input);
843 844 if (err < 0) {
844   - hci_conn_put_device(session->conn);
  845 + input_free_device(input);
  846 + session->input = NULL;
845 847 return err;
846 848 }
847 849  
... ... @@ -1044,8 +1046,12 @@
1044 1046 }
1045 1047  
1046 1048 err = hid_add_device(session->hid);
1047   - if (err < 0)
1048   - goto err_add_device;
  1049 + if (err < 0) {
  1050 + atomic_inc(&session->terminate);
  1051 + wake_up_process(session->task);
  1052 + up_write(&hidp_session_sem);
  1053 + return err;
  1054 + }
1049 1055  
1050 1056 if (session->input) {
1051 1057 hidp_send_ctrl_message(session,
... ... @@ -1059,12 +1065,6 @@
1059 1065 up_write(&hidp_session_sem);
1060 1066 return 0;
1061 1067  
1062   -err_add_device:
1063   - hid_destroy_device(session->hid);
1064   - session->hid = NULL;
1065   - atomic_inc(&session->terminate);
1066   - wake_up_process(session->task);
1067   -
1068 1068 unlink:
1069 1069 hidp_del_timer(session);
1070 1070  
... ... @@ -1090,7 +1090,6 @@
1090 1090 failed:
1091 1091 up_write(&hidp_session_sem);
1092 1092  
1093   - input_free_device(session->input);
1094 1093 kfree(session);
1095 1094 return err;
1096 1095 }
net/bluetooth/l2cap_core.c
... ... @@ -1159,9 +1159,8 @@
1159 1159 int timeo = HZ/5;
1160 1160  
1161 1161 add_wait_queue(sk_sleep(sk), &wait);
1162   - while ((chan->unacked_frames > 0 && chan->conn)) {
1163   - set_current_state(TASK_INTERRUPTIBLE);
1164   -
  1162 + set_current_state(TASK_INTERRUPTIBLE);
  1163 + while (chan->unacked_frames > 0 && chan->conn) {
1165 1164 if (!timeo)
1166 1165 timeo = HZ/5;
1167 1166  
... ... @@ -1173,6 +1172,7 @@
1173 1172 release_sock(sk);
1174 1173 timeo = schedule_timeout(timeo);
1175 1174 lock_sock(sk);
  1175 + set_current_state(TASK_INTERRUPTIBLE);
1176 1176  
1177 1177 err = sock_error(sk);
1178 1178 if (err)
net/bluetooth/l2cap_sock.c
... ... @@ -235,30 +235,26 @@
235 235  
236 236 lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
237 237  
238   - if (sk->sk_state != BT_LISTEN) {
239   - err = -EBADFD;
240   - goto done;
241   - }
242   -
243 238 timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK);
244 239  
245 240 BT_DBG("sk %p timeo %ld", sk, timeo);
246 241  
247 242 /* Wait for an incoming connection. (wake-one). */
248 243 add_wait_queue_exclusive(sk_sleep(sk), &wait);
249   - while (!(nsk = bt_accept_dequeue(sk, newsock))) {
  244 + while (1) {
250 245 set_current_state(TASK_INTERRUPTIBLE);
251   - if (!timeo) {
252   - err = -EAGAIN;
  246 +
  247 + if (sk->sk_state != BT_LISTEN) {
  248 + err = -EBADFD;
253 249 break;
254 250 }
255 251  
256   - release_sock(sk);
257   - timeo = schedule_timeout(timeo);
258   - lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
  252 + nsk = bt_accept_dequeue(sk, newsock);
  253 + if (nsk)
  254 + break;
259 255  
260   - if (sk->sk_state != BT_LISTEN) {
261   - err = -EBADFD;
  256 + if (!timeo) {
  257 + err = -EAGAIN;
262 258 break;
263 259 }
264 260  
265 261  
... ... @@ -266,8 +262,12 @@
266 262 err = sock_intr_errno(timeo);
267 263 break;
268 264 }
  265 +
  266 + release_sock(sk);
  267 + timeo = schedule_timeout(timeo);
  268 + lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
269 269 }
270   - set_current_state(TASK_RUNNING);
  270 + __set_current_state(TASK_RUNNING);
271 271 remove_wait_queue(sk_sleep(sk), &wait);
272 272  
273 273 if (err)
... ... @@ -993,7 +993,7 @@
993 993 INIT_LIST_HEAD(&bt_sk(sk)->accept_q);
994 994  
995 995 sk->sk_destruct = l2cap_sock_destruct;
996   - sk->sk_sndtimeo = msecs_to_jiffies(L2CAP_CONN_TIMEOUT);
  996 + sk->sk_sndtimeo = L2CAP_CONN_TIMEOUT;
997 997  
998 998 sock_reset_flag(sk, SOCK_ZAPPED);
999 999  
net/bluetooth/rfcomm/core.c
... ... @@ -62,7 +62,6 @@
62 62 #define rfcomm_lock() mutex_lock(&rfcomm_mutex)
63 63 #define rfcomm_unlock() mutex_unlock(&rfcomm_mutex)
64 64  
65   -static unsigned long rfcomm_event;
66 65  
67 66 static LIST_HEAD(session_list);
68 67  
... ... @@ -120,7 +119,6 @@
120 119 {
121 120 if (!rfcomm_thread)
122 121 return;
123   - set_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
124 122 wake_up_process(rfcomm_thread);
125 123 }
126 124  
127 125  
128 126  
129 127  
130 128  
131 129  
... ... @@ -2038,19 +2036,18 @@
2038 2036  
2039 2037 rfcomm_add_listener(BDADDR_ANY);
2040 2038  
2041   - while (!kthread_should_stop()) {
  2039 + while (1) {
2042 2040 set_current_state(TASK_INTERRUPTIBLE);
2043   - if (!test_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) {
2044   - /* No pending events. Let's sleep.
2045   - * Incoming connections and data will wake us up. */
2046   - schedule();
2047   - }
2048   - set_current_state(TASK_RUNNING);
2049 2041  
  2042 + if (kthread_should_stop())
  2043 + break;
  2044 +
2050 2045 /* Process stuff */
2051   - clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
2052 2046 rfcomm_process_sessions();
  2047 +
  2048 + schedule();
2053 2049 }
  2050 + __set_current_state(TASK_RUNNING);
2054 2051  
2055 2052 rfcomm_kill_listener();
2056 2053  
net/bluetooth/rfcomm/sock.c
... ... @@ -485,11 +485,6 @@
485 485  
486 486 lock_sock(sk);
487 487  
488   - if (sk->sk_state != BT_LISTEN) {
489   - err = -EBADFD;
490   - goto done;
491   - }
492   -
493 488 if (sk->sk_type != SOCK_STREAM) {
494 489 err = -EINVAL;
495 490 goto done;
496 491  
497 492  
498 493  
... ... @@ -501,19 +496,20 @@
501 496  
502 497 /* Wait for an incoming connection. (wake-one). */
503 498 add_wait_queue_exclusive(sk_sleep(sk), &wait);
504   - while (!(nsk = bt_accept_dequeue(sk, newsock))) {
  499 + while (1) {
505 500 set_current_state(TASK_INTERRUPTIBLE);
506   - if (!timeo) {
507   - err = -EAGAIN;
  501 +
  502 + if (sk->sk_state != BT_LISTEN) {
  503 + err = -EBADFD;
508 504 break;
509 505 }
510 506  
511   - release_sock(sk);
512   - timeo = schedule_timeout(timeo);
513   - lock_sock(sk);
  507 + nsk = bt_accept_dequeue(sk, newsock);
  508 + if (nsk)
  509 + break;
514 510  
515   - if (sk->sk_state != BT_LISTEN) {
516   - err = -EBADFD;
  511 + if (!timeo) {
  512 + err = -EAGAIN;
517 513 break;
518 514 }
519 515  
520 516  
... ... @@ -521,8 +517,12 @@
521 517 err = sock_intr_errno(timeo);
522 518 break;
523 519 }
  520 +
  521 + release_sock(sk);
  522 + timeo = schedule_timeout(timeo);
  523 + lock_sock(sk);
524 524 }
525   - set_current_state(TASK_RUNNING);
  525 + __set_current_state(TASK_RUNNING);
526 526 remove_wait_queue(sk_sleep(sk), &wait);
527 527  
528 528 if (err)
... ... @@ -564,30 +564,26 @@
564 564  
565 565 lock_sock(sk);
566 566  
567   - if (sk->sk_state != BT_LISTEN) {
568   - err = -EBADFD;
569   - goto done;
570   - }
571   -
572 567 timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK);
573 568  
574 569 BT_DBG("sk %p timeo %ld", sk, timeo);
575 570  
576 571 /* Wait for an incoming connection. (wake-one). */
577 572 add_wait_queue_exclusive(sk_sleep(sk), &wait);
578   - while (!(ch = bt_accept_dequeue(sk, newsock))) {
  573 + while (1) {
579 574 set_current_state(TASK_INTERRUPTIBLE);
580   - if (!timeo) {
581   - err = -EAGAIN;
  575 +
  576 + if (sk->sk_state != BT_LISTEN) {
  577 + err = -EBADFD;
582 578 break;
583 579 }
584 580  
585   - release_sock(sk);
586   - timeo = schedule_timeout(timeo);
587   - lock_sock(sk);
  581 + ch = bt_accept_dequeue(sk, newsock);
  582 + if (ch)
  583 + break;
588 584  
589   - if (sk->sk_state != BT_LISTEN) {
590   - err = -EBADFD;
  585 + if (!timeo) {
  586 + err = -EAGAIN;
591 587 break;
592 588 }
593 589  
594 590  
... ... @@ -595,8 +591,12 @@
595 591 err = sock_intr_errno(timeo);
596 592 break;
597 593 }
  594 +
  595 + release_sock(sk);
  596 + timeo = schedule_timeout(timeo);
  597 + lock_sock(sk);
598 598 }
599   - set_current_state(TASK_RUNNING);
  599 + __set_current_state(TASK_RUNNING);
600 600 remove_wait_queue(sk_sleep(sk), &wait);
601 601  
602 602 if (err)
net/bridge/br_multicast.c
... ... @@ -1456,7 +1456,7 @@
1456 1456 {
1457 1457 struct sk_buff *skb2;
1458 1458 const struct ipv6hdr *ip6h;
1459   - struct icmp6hdr *icmp6h;
  1459 + u8 icmp6_type;
1460 1460 u8 nexthdr;
1461 1461 unsigned len;
1462 1462 int offset;
1463 1463  
... ... @@ -1502,9 +1502,9 @@
1502 1502 __skb_pull(skb2, offset);
1503 1503 skb_reset_transport_header(skb2);
1504 1504  
1505   - icmp6h = icmp6_hdr(skb2);
  1505 + icmp6_type = icmp6_hdr(skb2)->icmp6_type;
1506 1506  
1507   - switch (icmp6h->icmp6_type) {
  1507 + switch (icmp6_type) {
1508 1508 case ICMPV6_MGM_QUERY:
1509 1509 case ICMPV6_MGM_REPORT:
1510 1510 case ICMPV6_MGM_REDUCTION:
1511 1511  
1512 1512  
1513 1513  
... ... @@ -1520,16 +1520,23 @@
1520 1520 err = pskb_trim_rcsum(skb2, len);
1521 1521 if (err)
1522 1522 goto out;
  1523 + err = -EINVAL;
1523 1524 }
1524 1525  
  1526 + ip6h = ipv6_hdr(skb2);
  1527 +
1525 1528 switch (skb2->ip_summed) {
1526 1529 case CHECKSUM_COMPLETE:
1527   - if (!csum_fold(skb2->csum))
  1530 + if (!csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr, skb2->len,
  1531 + IPPROTO_ICMPV6, skb2->csum))
1528 1532 break;
1529 1533 /*FALLTHROUGH*/
1530 1534 case CHECKSUM_NONE:
1531   - skb2->csum = 0;
1532   - if (skb_checksum_complete(skb2))
  1535 + skb2->csum = ~csum_unfold(csum_ipv6_magic(&ip6h->saddr,
  1536 + &ip6h->daddr,
  1537 + skb2->len,
  1538 + IPPROTO_ICMPV6, 0));
  1539 + if (__skb_checksum_complete(skb2))
1533 1540 goto out;
1534 1541 }
1535 1542  
... ... @@ -1537,7 +1544,7 @@
1537 1544  
1538 1545 BR_INPUT_SKB_CB(skb)->igmp = 1;
1539 1546  
1540   - switch (icmp6h->icmp6_type) {
  1547 + switch (icmp6_type) {
1541 1548 case ICMPV6_MGM_REPORT:
1542 1549 {
1543 1550 struct mld_msg *mld;
net/core/neighbour.c
... ... @@ -1319,11 +1319,15 @@
1319 1319  
1320 1320 if (tdif <= 0) {
1321 1321 struct net_device *dev = skb->dev;
  1322 +
1322 1323 __skb_unlink(skb, &tbl->proxy_queue);
1323   - if (tbl->proxy_redo && netif_running(dev))
  1324 + if (tbl->proxy_redo && netif_running(dev)) {
  1325 + rcu_read_lock();
1324 1326 tbl->proxy_redo(skb);
1325   - else
  1327 + rcu_read_unlock();
  1328 + } else {
1326 1329 kfree_skb(skb);
  1330 + }
1327 1331  
1328 1332 dev_put(dev);
1329 1333 } else if (!sched_next || tdif < sched_next)
... ... @@ -558,13 +558,14 @@
558 558 if (skb_shared(skb))
559 559 goto out;
560 560  
561   - iph = (struct iphdr *)skb->data;
562 561 if (!pskb_may_pull(skb, sizeof(struct iphdr)))
563 562 goto out;
  563 + iph = (struct iphdr *)skb->data;
564 564 if (iph->ihl < 5 || iph->version != 4)
565 565 goto out;
566 566 if (!pskb_may_pull(skb, iph->ihl*4))
567 567 goto out;
  568 + iph = (struct iphdr *)skb->data;
568 569 if (ip_fast_csum((u8 *)iph, iph->ihl) != 0)
569 570 goto out;
570 571  
... ... @@ -579,6 +580,7 @@
579 580 if (pskb_trim_rcsum(skb, len))
580 581 goto out;
581 582  
  583 + iph = (struct iphdr *)skb->data;
582 584 if (iph->protocol != IPPROTO_UDP)
583 585 goto out;
584 586  
... ... @@ -767,7 +767,7 @@
767 767 break;
768 768 for (i=0; i<nsrcs; i++) {
769 769 /* skip inactive filters */
770   - if (pmc->sfcount[MCAST_INCLUDE] ||
  770 + if (psf->sf_count[MCAST_INCLUDE] ||
771 771 pmc->sfcount[MCAST_EXCLUDE] !=
772 772 psf->sf_count[MCAST_EXCLUDE])
773 773 continue;
... ... @@ -1059,7 +1059,7 @@
1059 1059 break;
1060 1060 for (i=0; i<nsrcs; i++) {
1061 1061 /* skip inactive filters */
1062   - if (pmc->mca_sfcount[MCAST_INCLUDE] ||
  1062 + if (psf->sf_count[MCAST_INCLUDE] ||
1063 1063 pmc->mca_sfcount[MCAST_EXCLUDE] !=
1064 1064 psf->sf_count[MCAST_EXCLUDE])
1065 1065 continue;
... ... @@ -1012,7 +1012,6 @@
1012 1012 cancel_work_sync(&local->reconfig_filter);
1013 1013  
1014 1014 ieee80211_clear_tx_pending(local);
1015   - sta_info_stop(local);
1016 1015 rate_control_deinitialize(local);
1017 1016  
1018 1017 if (skb_queue_len(&local->skb_queue) ||
... ... @@ -1024,6 +1023,7 @@
1024 1023  
1025 1024 destroy_workqueue(local->workqueue);
1026 1025 wiphy_unregister(local->hw.wiphy);
  1026 + sta_info_stop(local);
1027 1027 ieee80211_wep_free(local);
1028 1028 ieee80211_led_exit(local);
1029 1029 kfree(local->int_scan_req);
... ... @@ -1965,8 +1965,9 @@
1965 1965 * used_address->name_len is initialized to UINT_MAX so that the first
1966 1966 * destination address never matches.
1967 1967 */
1968   - if (used_address && used_address->name_len == msg_sys->msg_namelen &&
1969   - !memcmp(&used_address->name, msg->msg_name,
  1968 + if (used_address && msg_sys->msg_name &&
  1969 + used_address->name_len == msg_sys->msg_namelen &&
  1970 + !memcmp(&used_address->name, msg_sys->msg_name,
1970 1971 used_address->name_len)) {
1971 1972 err = sock_sendmsg_nosec(sock, msg_sys, total_len);
1972 1973 goto out_freectl;
... ... @@ -1978,8 +1979,9 @@
1978 1979 */
1979 1980 if (used_address && err >= 0) {
1980 1981 used_address->name_len = msg_sys->msg_namelen;
1981   - memcpy(&used_address->name, msg->msg_name,
1982   - used_address->name_len);
  1982 + if (msg_sys->msg_name)
  1983 + memcpy(&used_address->name, msg_sys->msg_name,
  1984 + used_address->name_len);
1983 1985 }
1984 1986  
1985 1987 out_freectl:
... ... @@ -616,6 +616,9 @@
616 616 if (res)
617 617 goto out_rm_dev;
618 618  
  619 + rtnl_lock();
  620 + rdev->wiphy.registered = true;
  621 + rtnl_unlock();
619 622 return 0;
620 623  
621 624 out_rm_dev:
... ... @@ -646,6 +649,10 @@
646 649 void wiphy_unregister(struct wiphy *wiphy)
647 650 {
648 651 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
  652 +
  653 + rtnl_lock();
  654 + rdev->wiphy.registered = false;
  655 + rtnl_unlock();
649 656  
650 657 rfkill_unregister(rdev->rfkill);
651 658  
net/wireless/sysfs.c
... ... @@ -93,7 +93,8 @@
93 93  
94 94 if (rdev->ops->suspend) {
95 95 rtnl_lock();
96   - ret = rdev->ops->suspend(&rdev->wiphy, rdev->wowlan);
  96 + if (rdev->wiphy.registered)
  97 + ret = rdev->ops->suspend(&rdev->wiphy, rdev->wowlan);
97 98 rtnl_unlock();
98 99 }
99 100  
... ... @@ -112,7 +113,8 @@
112 113  
113 114 if (rdev->ops->resume) {
114 115 rtnl_lock();
115   - ret = rdev->ops->resume(&rdev->wiphy);
  116 + if (rdev->wiphy.registered)
  117 + ret = rdev->ops->resume(&rdev->wiphy);
116 118 rtnl_unlock();
117 119 }
118 120