aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS5
-rw-r--r--arch/x86/include/asm/pgtable.h14
-rw-r--r--arch/x86/include/asm/topology.h3
-rw-r--r--arch/x86/xen/mmu.c4
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c14
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c17
-rw-r--r--drivers/gpu/drm/udl/udl_gem.c11
-rw-r--r--drivers/i2c/busses/i2c-cpm.c2
-rw-r--r--drivers/input/keyboard/adp5588-keys.c12
-rw-r--r--drivers/input/misc/da9052_onkey.c29
-rw-r--r--drivers/input/mouse/cypress_ps2.c1
-rw-r--r--drivers/input/mouse/synaptics.c55
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c5
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c43
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c6
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge_main.c4
-rw-r--r--drivers/net/ifb.c3
-rw-r--r--drivers/net/usb/usbnet.c33
-rw-r--r--drivers/net/veth.c5
-rw-r--r--drivers/net/virtio_net.c6
-rw-r--r--drivers/vhost/net.c20
-rw-r--r--drivers/xen/balloon.c24
-rw-r--r--fs/anon_inodes.c34
-rw-r--r--fs/ocfs2/stackglue.c4
-rw-r--r--include/linux/netdev_features.h7
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/skbuff.h4
-rw-r--r--include/linux/usb/usbnet.h2
-rw-r--r--include/net/if_inet6.h4
-rw-r--r--kernel/trace/trace.c27
-rw-r--r--lib/random32.c13
-rw-r--r--net/8021q/vlan.c4
-rw-r--r--net/8021q/vlan_dev.c6
-rw-r--r--net/bridge/br_device.c6
-rw-r--r--net/bridge/br_input.c11
-rw-r--r--net/bridge/br_vlan.c44
-rw-r--r--net/core/dev.c13
-rw-r--r--net/core/skbuff.c30
-rw-r--r--net/ipv4/gre_demux.c8
-rw-r--r--net/ipv4/ip_tunnel.c3
-rw-r--r--net/ipv4/ip_tunnel_core.c1
-rw-r--r--net/ipv4/tcp_ipv4.c2
-rw-r--r--net/ipv6/addrconf.c193
-rw-r--r--net/netfilter/nfnetlink_queue_core.c9
-rw-r--r--net/openvswitch/datapath.c6
-rw-r--r--net/openvswitch/flow.c26
-rw-r--r--net/unix/af_unix.c17
48 files changed, 527 insertions, 267 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index f779c91122bc..162b0fe3b001 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1839,8 +1839,8 @@ F: net/bluetooth/
1839F: include/net/bluetooth/ 1839F: include/net/bluetooth/
1840 1840
1841BONDING DRIVER 1841BONDING DRIVER
1842M: Jay Vosburgh <fubar@us.ibm.com> 1842M: Jay Vosburgh <j.vosburgh@gmail.com>
1843M: Veaceslav Falico <vfalico@redhat.com> 1843M: Veaceslav Falico <vfalico@gmail.com>
1844M: Andy Gospodarek <andy@greyhouse.net> 1844M: Andy Gospodarek <andy@greyhouse.net>
1845L: netdev@vger.kernel.org 1845L: netdev@vger.kernel.org
1846W: http://sourceforge.net/projects/bonding/ 1846W: http://sourceforge.net/projects/bonding/
@@ -6019,6 +6019,7 @@ F: include/uapi/linux/net.h
6019F: include/uapi/linux/netdevice.h 6019F: include/uapi/linux/netdevice.h
6020F: tools/net/ 6020F: tools/net/
6021F: tools/testing/selftests/net/ 6021F: tools/testing/selftests/net/
6022F: lib/random32.c
6022 6023
6023NETWORKING [IPv4/IPv6] 6024NETWORKING [IPv4/IPv6]
6024M: "David S. Miller" <davem@davemloft.net> 6025M: "David S. Miller" <davem@davemloft.net>
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 5ad38ad07890..bbc8b12fa443 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -445,20 +445,10 @@ static inline int pte_same(pte_t a, pte_t b)
445 return a.pte == b.pte; 445 return a.pte == b.pte;
446} 446}
447 447
448static inline int pteval_present(pteval_t pteval)
449{
450 /*
451 * Yes Linus, _PAGE_PROTNONE == _PAGE_NUMA. Expressing it this
452 * way clearly states that the intent is that protnone and numa
453 * hinting ptes are considered present for the purposes of
454 * pagetable operations like zapping, protection changes, gup etc.
455 */
456 return pteval & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_NUMA);
457}
458
459static inline int pte_present(pte_t a) 448static inline int pte_present(pte_t a)
460{ 449{
461 return pteval_present(pte_flags(a)); 450 return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE |
451 _PAGE_NUMA);
462} 452}
463 453
464#define pte_accessible pte_accessible 454#define pte_accessible pte_accessible
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index d35f24e231cd..1306d117967d 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -119,9 +119,10 @@ static inline void setup_node_to_cpumask_map(void) { }
119 119
120extern const struct cpumask *cpu_coregroup_mask(int cpu); 120extern const struct cpumask *cpu_coregroup_mask(int cpu);
121 121
122#ifdef ENABLE_TOPO_DEFINES
123#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) 122#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
124#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) 123#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
124
125#ifdef ENABLE_TOPO_DEFINES
125#define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu)) 126#define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
126#define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu)) 127#define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
127#endif 128#endif
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 256282e7888b..2423ef04ffea 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -365,7 +365,7 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
365/* Assume pteval_t is equivalent to all the other *val_t types. */ 365/* Assume pteval_t is equivalent to all the other *val_t types. */
366static pteval_t pte_mfn_to_pfn(pteval_t val) 366static pteval_t pte_mfn_to_pfn(pteval_t val)
367{ 367{
368 if (pteval_present(val)) { 368 if (val & _PAGE_PRESENT) {
369 unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; 369 unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
370 unsigned long pfn = mfn_to_pfn(mfn); 370 unsigned long pfn = mfn_to_pfn(mfn);
371 371
@@ -381,7 +381,7 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)
381 381
382static pteval_t pte_pfn_to_mfn(pteval_t val) 382static pteval_t pte_pfn_to_mfn(pteval_t val)
383{ 383{
384 if (pteval_present(val)) { 384 if (val & _PAGE_PRESENT) {
385 unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; 385 unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
386 pteval_t flags = val & PTE_FLAGS_MASK; 386 pteval_t flags = val & PTE_FLAGS_MASK;
387 unsigned long mfn; 387 unsigned long mfn;
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 40a2b36b276b..d278be110805 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -842,7 +842,7 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev)
842 dev_priv->gtt.base.clear_range(&dev_priv->gtt.base, 842 dev_priv->gtt.base.clear_range(&dev_priv->gtt.base,
843 dev_priv->gtt.base.start / PAGE_SIZE, 843 dev_priv->gtt.base.start / PAGE_SIZE,
844 dev_priv->gtt.base.total / PAGE_SIZE, 844 dev_priv->gtt.base.total / PAGE_SIZE,
845 false); 845 true);
846} 846}
847 847
848void i915_gem_restore_gtt_mappings(struct drm_device *dev) 848void i915_gem_restore_gtt_mappings(struct drm_device *dev)
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 89c484d8ac26..4ee702ac8907 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -866,13 +866,16 @@ static int nouveau_pmops_runtime_suspend(struct device *dev)
866 struct drm_device *drm_dev = pci_get_drvdata(pdev); 866 struct drm_device *drm_dev = pci_get_drvdata(pdev);
867 int ret; 867 int ret;
868 868
869 if (nouveau_runtime_pm == 0) 869 if (nouveau_runtime_pm == 0) {
870 return -EINVAL; 870 pm_runtime_forbid(dev);
871 return -EBUSY;
872 }
871 873
872 /* are we optimus enabled? */ 874 /* are we optimus enabled? */
873 if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) { 875 if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
874 DRM_DEBUG_DRIVER("failing to power off - not optimus\n"); 876 DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
875 return -EINVAL; 877 pm_runtime_forbid(dev);
878 return -EBUSY;
876 } 879 }
877 880
878 nv_debug_level(SILENT); 881 nv_debug_level(SILENT);
@@ -923,12 +926,15 @@ static int nouveau_pmops_runtime_idle(struct device *dev)
923 struct nouveau_drm *drm = nouveau_drm(drm_dev); 926 struct nouveau_drm *drm = nouveau_drm(drm_dev);
924 struct drm_crtc *crtc; 927 struct drm_crtc *crtc;
925 928
926 if (nouveau_runtime_pm == 0) 929 if (nouveau_runtime_pm == 0) {
930 pm_runtime_forbid(dev);
927 return -EBUSY; 931 return -EBUSY;
932 }
928 933
929 /* are we optimus enabled? */ 934 /* are we optimus enabled? */
930 if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) { 935 if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
931 DRM_DEBUG_DRIVER("failing to power off - not optimus\n"); 936 DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
937 pm_runtime_forbid(dev);
932 return -EBUSY; 938 return -EBUSY;
933 } 939 }
934 940
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 84a1bbb75f91..f633c2782170 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -403,11 +403,15 @@ static int radeon_pmops_runtime_suspend(struct device *dev)
403 struct drm_device *drm_dev = pci_get_drvdata(pdev); 403 struct drm_device *drm_dev = pci_get_drvdata(pdev);
404 int ret; 404 int ret;
405 405
406 if (radeon_runtime_pm == 0) 406 if (radeon_runtime_pm == 0) {
407 return -EINVAL; 407 pm_runtime_forbid(dev);
408 return -EBUSY;
409 }
408 410
409 if (radeon_runtime_pm == -1 && !radeon_is_px()) 411 if (radeon_runtime_pm == -1 && !radeon_is_px()) {
410 return -EINVAL; 412 pm_runtime_forbid(dev);
413 return -EBUSY;
414 }
411 415
412 drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; 416 drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
413 drm_kms_helper_poll_disable(drm_dev); 417 drm_kms_helper_poll_disable(drm_dev);
@@ -456,12 +460,15 @@ static int radeon_pmops_runtime_idle(struct device *dev)
456 struct drm_device *drm_dev = pci_get_drvdata(pdev); 460 struct drm_device *drm_dev = pci_get_drvdata(pdev);
457 struct drm_crtc *crtc; 461 struct drm_crtc *crtc;
458 462
459 if (radeon_runtime_pm == 0) 463 if (radeon_runtime_pm == 0) {
464 pm_runtime_forbid(dev);
460 return -EBUSY; 465 return -EBUSY;
466 }
461 467
462 /* are we PX enabled? */ 468 /* are we PX enabled? */
463 if (radeon_runtime_pm == -1 && !radeon_is_px()) { 469 if (radeon_runtime_pm == -1 && !radeon_is_px()) {
464 DRM_DEBUG_DRIVER("failing to power off - not px\n"); 470 DRM_DEBUG_DRIVER("failing to power off - not px\n");
471 pm_runtime_forbid(dev);
465 return -EBUSY; 472 return -EBUSY;
466 } 473 }
467 474
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c
index 8d67b943ac05..0394811251bd 100644
--- a/drivers/gpu/drm/udl/udl_gem.c
+++ b/drivers/gpu/drm/udl/udl_gem.c
@@ -177,8 +177,10 @@ void udl_gem_free_object(struct drm_gem_object *gem_obj)
177 if (obj->vmapping) 177 if (obj->vmapping)
178 udl_gem_vunmap(obj); 178 udl_gem_vunmap(obj);
179 179
180 if (gem_obj->import_attach) 180 if (gem_obj->import_attach) {
181 drm_prime_gem_destroy(gem_obj, obj->sg); 181 drm_prime_gem_destroy(gem_obj, obj->sg);
182 put_device(gem_obj->dev->dev);
183 }
182 184
183 if (obj->pages) 185 if (obj->pages)
184 udl_gem_put_pages(obj); 186 udl_gem_put_pages(obj);
@@ -256,9 +258,12 @@ struct drm_gem_object *udl_gem_prime_import(struct drm_device *dev,
256 int ret; 258 int ret;
257 259
258 /* need to attach */ 260 /* need to attach */
261 get_device(dev->dev);
259 attach = dma_buf_attach(dma_buf, dev->dev); 262 attach = dma_buf_attach(dma_buf, dev->dev);
260 if (IS_ERR(attach)) 263 if (IS_ERR(attach)) {
264 put_device(dev->dev);
261 return ERR_CAST(attach); 265 return ERR_CAST(attach);
266 }
262 267
263 get_dma_buf(dma_buf); 268 get_dma_buf(dma_buf);
264 269
@@ -282,6 +287,6 @@ fail_unmap:
282fail_detach: 287fail_detach:
283 dma_buf_detach(dma_buf, attach); 288 dma_buf_detach(dma_buf, attach);
284 dma_buf_put(dma_buf); 289 dma_buf_put(dma_buf);
285 290 put_device(dev->dev);
286 return ERR_PTR(ret); 291 return ERR_PTR(ret);
287} 292}
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index be7f0a20d634..f3b89a4698b6 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -39,7 +39,9 @@
39#include <linux/i2c.h> 39#include <linux/i2c.h>
40#include <linux/io.h> 40#include <linux/io.h>
41#include <linux/dma-mapping.h> 41#include <linux/dma-mapping.h>
42#include <linux/of_address.h>
42#include <linux/of_device.h> 43#include <linux/of_device.h>
44#include <linux/of_irq.h>
43#include <linux/of_platform.h> 45#include <linux/of_platform.h>
44#include <sysdev/fsl_soc.h> 46#include <sysdev/fsl_soc.h>
45#include <asm/cpm.h> 47#include <asm/cpm.h>
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index bb3b57bea8ba..5ef7fcf0e250 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -76,8 +76,18 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
76 struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); 76 struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
77 unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); 77 unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
78 unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); 78 unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
79 int val;
79 80
80 return !!(adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank) & bit); 81 mutex_lock(&kpad->gpio_lock);
82
83 if (kpad->dir[bank] & bit)
84 val = kpad->dat_out[bank];
85 else
86 val = adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank);
87
88 mutex_unlock(&kpad->gpio_lock);
89
90 return !!(val & bit);
81} 91}
82 92
83static void adp5588_gpio_set_value(struct gpio_chip *chip, 93static void adp5588_gpio_set_value(struct gpio_chip *chip,
diff --git a/drivers/input/misc/da9052_onkey.c b/drivers/input/misc/da9052_onkey.c
index 1f695f229ea8..184c8f21ab59 100644
--- a/drivers/input/misc/da9052_onkey.c
+++ b/drivers/input/misc/da9052_onkey.c
@@ -27,29 +27,32 @@ struct da9052_onkey {
27 27
28static void da9052_onkey_query(struct da9052_onkey *onkey) 28static void da9052_onkey_query(struct da9052_onkey *onkey)
29{ 29{
30 int key_stat; 30 int ret;
31 31
32 key_stat = da9052_reg_read(onkey->da9052, DA9052_EVENT_B_REG); 32 ret = da9052_reg_read(onkey->da9052, DA9052_STATUS_A_REG);
33 if (key_stat < 0) { 33 if (ret < 0) {
34 dev_err(onkey->da9052->dev, 34 dev_err(onkey->da9052->dev,
35 "Failed to read onkey event %d\n", key_stat); 35 "Failed to read onkey event err=%d\n", ret);
36 } else { 36 } else {
37 /* 37 /*
38 * Since interrupt for deassertion of ONKEY pin is not 38 * Since interrupt for deassertion of ONKEY pin is not
39 * generated, onkey event state determines the onkey 39 * generated, onkey event state determines the onkey
40 * button state. 40 * button state.
41 */ 41 */
42 key_stat &= DA9052_EVENTB_ENONKEY; 42 bool pressed = !(ret & DA9052_STATUSA_NONKEY);
43 input_report_key(onkey->input, KEY_POWER, key_stat); 43
44 input_report_key(onkey->input, KEY_POWER, pressed);
44 input_sync(onkey->input); 45 input_sync(onkey->input);
45 }
46 46
47 /* 47 /*
48 * Interrupt is generated only when the ONKEY pin is asserted. 48 * Interrupt is generated only when the ONKEY pin
49 * Hence the deassertion of the pin is simulated through work queue. 49 * is asserted. Hence the deassertion of the pin
50 */ 50 * is simulated through work queue.
51 if (key_stat) 51 */
52 schedule_delayed_work(&onkey->work, msecs_to_jiffies(50)); 52 if (pressed)
53 schedule_delayed_work(&onkey->work,
54 msecs_to_jiffies(50));
55 }
53} 56}
54 57
55static void da9052_onkey_work(struct work_struct *work) 58static void da9052_onkey_work(struct work_struct *work)
diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index 87095e2f5153..8af34ffe208b 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -409,7 +409,6 @@ static int cypress_set_input_params(struct input_dev *input,
409 __clear_bit(REL_X, input->relbit); 409 __clear_bit(REL_X, input->relbit);
410 __clear_bit(REL_Y, input->relbit); 410 __clear_bit(REL_Y, input->relbit);
411 411
412 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
413 __set_bit(EV_KEY, input->evbit); 412 __set_bit(EV_KEY, input->evbit);
414 __set_bit(BTN_LEFT, input->keybit); 413 __set_bit(BTN_LEFT, input->keybit);
415 __set_bit(BTN_RIGHT, input->keybit); 414 __set_bit(BTN_RIGHT, input->keybit);
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 26386f9d2569..d8d49d10f9bb 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -265,11 +265,22 @@ static int synaptics_identify(struct psmouse *psmouse)
265 * Read touchpad resolution and maximum reported coordinates 265 * Read touchpad resolution and maximum reported coordinates
266 * Resolution is left zero if touchpad does not support the query 266 * Resolution is left zero if touchpad does not support the query
267 */ 267 */
268
269static const int *quirk_min_max;
270
268static int synaptics_resolution(struct psmouse *psmouse) 271static int synaptics_resolution(struct psmouse *psmouse)
269{ 272{
270 struct synaptics_data *priv = psmouse->private; 273 struct synaptics_data *priv = psmouse->private;
271 unsigned char resp[3]; 274 unsigned char resp[3];
272 275
276 if (quirk_min_max) {
277 priv->x_min = quirk_min_max[0];
278 priv->x_max = quirk_min_max[1];
279 priv->y_min = quirk_min_max[2];
280 priv->y_max = quirk_min_max[3];
281 return 0;
282 }
283
273 if (SYN_ID_MAJOR(priv->identity) < 4) 284 if (SYN_ID_MAJOR(priv->identity) < 4)
274 return 0; 285 return 0;
275 286
@@ -1485,10 +1496,54 @@ static const struct dmi_system_id olpc_dmi_table[] __initconst = {
1485 { } 1496 { }
1486}; 1497};
1487 1498
1499static const struct dmi_system_id min_max_dmi_table[] __initconst = {
1500#if defined(CONFIG_DMI)
1501 {
1502 /* Lenovo ThinkPad Helix */
1503 .matches = {
1504 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1505 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"),
1506 },
1507 .driver_data = (int []){1024, 5052, 2258, 4832},
1508 },
1509 {
1510 /* Lenovo ThinkPad X240 */
1511 .matches = {
1512 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1513 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X240"),
1514 },
1515 .driver_data = (int []){1232, 5710, 1156, 4696},
1516 },
1517 {
1518 /* Lenovo ThinkPad T440s */
1519 .matches = {
1520 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1521 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T440"),
1522 },
1523 .driver_data = (int []){1024, 5112, 2024, 4832},
1524 },
1525 {
1526 /* Lenovo ThinkPad T540p */
1527 .matches = {
1528 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1529 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"),
1530 },
1531 .driver_data = (int []){1024, 5056, 2058, 4832},
1532 },
1533#endif
1534 { }
1535};
1536
1488void __init synaptics_module_init(void) 1537void __init synaptics_module_init(void)
1489{ 1538{
1539 const struct dmi_system_id *min_max_dmi;
1540
1490 impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); 1541 impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
1491 broken_olpc_ec = dmi_check_system(olpc_dmi_table); 1542 broken_olpc_ec = dmi_check_system(olpc_dmi_table);
1543
1544 min_max_dmi = dmi_first_match(min_max_dmi_table);
1545 if (min_max_dmi)
1546 quirk_min_max = min_max_dmi->driver_data;
1492} 1547}
1493 1548
1494static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) 1549static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 22586e92da0e..b9f7022f4e81 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -17641,8 +17641,6 @@ static int tg3_init_one(struct pci_dev *pdev,
17641 17641
17642 tg3_init_bufmgr_config(tp); 17642 tg3_init_bufmgr_config(tp);
17643 17643
17644 features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
17645
17646 /* 5700 B0 chips do not support checksumming correctly due 17644 /* 5700 B0 chips do not support checksumming correctly due
17647 * to hardware bugs. 17645 * to hardware bugs.
17648 */ 17646 */
@@ -17674,7 +17672,8 @@ static int tg3_init_one(struct pci_dev *pdev,
17674 features |= NETIF_F_TSO_ECN; 17672 features |= NETIF_F_TSO_ECN;
17675 } 17673 }
17676 17674
17677 dev->features |= features; 17675 dev->features |= features | NETIF_F_HW_VLAN_CTAG_TX |
17676 NETIF_F_HW_VLAN_CTAG_RX;
17678 dev->vlan_features |= features; 17677 dev->vlan_features |= features;
17679 17678
17680 /* 17679 /*
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index bcce0b437722..d04b1c3c9b85 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -89,8 +89,9 @@
89#define MVNETA_TX_IN_PRGRS BIT(1) 89#define MVNETA_TX_IN_PRGRS BIT(1)
90#define MVNETA_TX_FIFO_EMPTY BIT(8) 90#define MVNETA_TX_FIFO_EMPTY BIT(8)
91#define MVNETA_RX_MIN_FRAME_SIZE 0x247c 91#define MVNETA_RX_MIN_FRAME_SIZE 0x247c
92#define MVNETA_SGMII_SERDES_CFG 0x24A0 92#define MVNETA_SERDES_CFG 0x24A0
93#define MVNETA_SGMII_SERDES_PROTO 0x0cc7 93#define MVNETA_SGMII_SERDES_PROTO 0x0cc7
94#define MVNETA_RGMII_SERDES_PROTO 0x0667
94#define MVNETA_TYPE_PRIO 0x24bc 95#define MVNETA_TYPE_PRIO 0x24bc
95#define MVNETA_FORCE_UNI BIT(21) 96#define MVNETA_FORCE_UNI BIT(21)
96#define MVNETA_TXQ_CMD_1 0x24e4 97#define MVNETA_TXQ_CMD_1 0x24e4
@@ -162,7 +163,7 @@
162#define MVNETA_GMAC_MAX_RX_SIZE_MASK 0x7ffc 163#define MVNETA_GMAC_MAX_RX_SIZE_MASK 0x7ffc
163#define MVNETA_GMAC0_PORT_ENABLE BIT(0) 164#define MVNETA_GMAC0_PORT_ENABLE BIT(0)
164#define MVNETA_GMAC_CTRL_2 0x2c08 165#define MVNETA_GMAC_CTRL_2 0x2c08
165#define MVNETA_GMAC2_PSC_ENABLE BIT(3) 166#define MVNETA_GMAC2_PCS_ENABLE BIT(3)
166#define MVNETA_GMAC2_PORT_RGMII BIT(4) 167#define MVNETA_GMAC2_PORT_RGMII BIT(4)
167#define MVNETA_GMAC2_PORT_RESET BIT(6) 168#define MVNETA_GMAC2_PORT_RESET BIT(6)
168#define MVNETA_GMAC_STATUS 0x2c10 169#define MVNETA_GMAC_STATUS 0x2c10
@@ -711,35 +712,6 @@ static void mvneta_rxq_bm_disable(struct mvneta_port *pp,
711 mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val); 712 mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
712} 713}
713 714
714
715
716/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */
717static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
718{
719 u32 val;
720
721 val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
722
723 if (enable)
724 val |= MVNETA_GMAC2_PORT_RGMII;
725 else
726 val &= ~MVNETA_GMAC2_PORT_RGMII;
727
728 mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
729}
730
731/* Config SGMII port */
732static void mvneta_port_sgmii_config(struct mvneta_port *pp)
733{
734 u32 val;
735
736 val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
737 val |= MVNETA_GMAC2_PSC_ENABLE;
738 mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
739
740 mvreg_write(pp, MVNETA_SGMII_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO);
741}
742
743/* Start the Ethernet port RX and TX activity */ 715/* Start the Ethernet port RX and TX activity */
744static void mvneta_port_up(struct mvneta_port *pp) 716static void mvneta_port_up(struct mvneta_port *pp)
745{ 717{
@@ -2757,12 +2729,15 @@ static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2757 mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0); 2729 mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0);
2758 2730
2759 if (phy_mode == PHY_INTERFACE_MODE_SGMII) 2731 if (phy_mode == PHY_INTERFACE_MODE_SGMII)
2760 mvneta_port_sgmii_config(pp); 2732 mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO);
2733 else
2734 mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_RGMII_SERDES_PROTO);
2761 2735
2762 mvneta_gmac_rgmii_set(pp, 1); 2736 val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
2737
2738 val |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII;
2763 2739
2764 /* Cancel Port Reset */ 2740 /* Cancel Port Reset */
2765 val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
2766 val &= ~MVNETA_GMAC2_PORT_RESET; 2741 val &= ~MVNETA_GMAC2_PORT_RESET;
2767 mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); 2742 mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
2768 2743
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 61d7bcff4533..f0ae95f66ceb 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2755,7 +2755,11 @@ static pci_ers_result_t mlx4_pci_err_detected(struct pci_dev *pdev,
2755 2755
2756static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev) 2756static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev)
2757{ 2757{
2758 int ret = __mlx4_init_one(pdev, 0); 2758 const struct pci_device_id *id;
2759 int ret;
2760
2761 id = pci_match_id(mlx4_pci_table, pdev);
2762 ret = __mlx4_init_one(pdev, id->driver_data);
2759 2763
2760 return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; 2764 return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED;
2761} 2765}
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 5b63405f9d3c..0a1d76acab81 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -4756,7 +4756,9 @@ static int qlge_probe(struct pci_dev *pdev,
4756 ndev->features = ndev->hw_features; 4756 ndev->features = ndev->hw_features;
4757 ndev->vlan_features = ndev->hw_features; 4757 ndev->vlan_features = ndev->hw_features;
4758 /* vlan gets same features (except vlan filter) */ 4758 /* vlan gets same features (except vlan filter) */
4759 ndev->vlan_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER; 4759 ndev->vlan_features &= ~(NETIF_F_HW_VLAN_CTAG_FILTER |
4760 NETIF_F_HW_VLAN_CTAG_TX |
4761 NETIF_F_HW_VLAN_CTAG_RX);
4760 4762
4761 if (test_bit(QL_DMA64, &qdev->flags)) 4763 if (test_bit(QL_DMA64, &qdev->flags))
4762 ndev->features |= NETIF_F_HIGHDMA; 4764 ndev->features |= NETIF_F_HIGHDMA;
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 1da36764b1a4..46a7790be004 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -180,7 +180,8 @@ static void ifb_setup(struct net_device *dev)
180 dev->tx_queue_len = TX_Q_LIMIT; 180 dev->tx_queue_len = TX_Q_LIMIT;
181 181
182 dev->features |= IFB_FEATURES; 182 dev->features |= IFB_FEATURES;
183 dev->vlan_features |= IFB_FEATURES; 183 dev->vlan_features |= IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX |
184 NETIF_F_HW_VLAN_STAG_TX);
184 185
185 dev->flags |= IFF_NOARP; 186 dev->flags |= IFF_NOARP;
186 dev->flags &= ~IFF_MULTICAST; 187 dev->flags &= ~IFF_MULTICAST;
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index dd10d5817d2a..f9e96c427558 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -752,14 +752,12 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs);
752// precondition: never called in_interrupt 752// precondition: never called in_interrupt
753static void usbnet_terminate_urbs(struct usbnet *dev) 753static void usbnet_terminate_urbs(struct usbnet *dev)
754{ 754{
755 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(unlink_wakeup);
756 DECLARE_WAITQUEUE(wait, current); 755 DECLARE_WAITQUEUE(wait, current);
757 int temp; 756 int temp;
758 757
759 /* ensure there are no more active urbs */ 758 /* ensure there are no more active urbs */
760 add_wait_queue(&unlink_wakeup, &wait); 759 add_wait_queue(&dev->wait, &wait);
761 set_current_state(TASK_UNINTERRUPTIBLE); 760 set_current_state(TASK_UNINTERRUPTIBLE);
762 dev->wait = &unlink_wakeup;
763 temp = unlink_urbs(dev, &dev->txq) + 761 temp = unlink_urbs(dev, &dev->txq) +
764 unlink_urbs(dev, &dev->rxq); 762 unlink_urbs(dev, &dev->rxq);
765 763
@@ -773,15 +771,14 @@ static void usbnet_terminate_urbs(struct usbnet *dev)
773 "waited for %d urb completions\n", temp); 771 "waited for %d urb completions\n", temp);
774 } 772 }
775 set_current_state(TASK_RUNNING); 773 set_current_state(TASK_RUNNING);
776 dev->wait = NULL; 774 remove_wait_queue(&dev->wait, &wait);
777 remove_wait_queue(&unlink_wakeup, &wait);
778} 775}
779 776
780int usbnet_stop (struct net_device *net) 777int usbnet_stop (struct net_device *net)
781{ 778{
782 struct usbnet *dev = netdev_priv(net); 779 struct usbnet *dev = netdev_priv(net);
783 struct driver_info *info = dev->driver_info; 780 struct driver_info *info = dev->driver_info;
784 int retval; 781 int retval, pm;
785 782
786 clear_bit(EVENT_DEV_OPEN, &dev->flags); 783 clear_bit(EVENT_DEV_OPEN, &dev->flags);
787 netif_stop_queue (net); 784 netif_stop_queue (net);
@@ -791,6 +788,8 @@ int usbnet_stop (struct net_device *net)
791 net->stats.rx_packets, net->stats.tx_packets, 788 net->stats.rx_packets, net->stats.tx_packets,
792 net->stats.rx_errors, net->stats.tx_errors); 789 net->stats.rx_errors, net->stats.tx_errors);
793 790
791 /* to not race resume */
792 pm = usb_autopm_get_interface(dev->intf);
794 /* allow minidriver to stop correctly (wireless devices to turn off 793 /* allow minidriver to stop correctly (wireless devices to turn off
795 * radio etc) */ 794 * radio etc) */
796 if (info->stop) { 795 if (info->stop) {
@@ -817,6 +816,9 @@ int usbnet_stop (struct net_device *net)
817 dev->flags = 0; 816 dev->flags = 0;
818 del_timer_sync (&dev->delay); 817 del_timer_sync (&dev->delay);
819 tasklet_kill (&dev->bh); 818 tasklet_kill (&dev->bh);
819 if (!pm)
820 usb_autopm_put_interface(dev->intf);
821
820 if (info->manage_power && 822 if (info->manage_power &&
821 !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags)) 823 !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags))
822 info->manage_power(dev, 0); 824 info->manage_power(dev, 0);
@@ -1437,11 +1439,12 @@ static void usbnet_bh (unsigned long param)
1437 /* restart RX again after disabling due to high error rate */ 1439 /* restart RX again after disabling due to high error rate */
1438 clear_bit(EVENT_RX_KILL, &dev->flags); 1440 clear_bit(EVENT_RX_KILL, &dev->flags);
1439 1441
1440 // waiting for all pending urbs to complete? 1442 /* waiting for all pending urbs to complete?
1441 if (dev->wait) { 1443 * only then can we forgo submitting anew
1442 if ((dev->txq.qlen + dev->rxq.qlen + dev->done.qlen) == 0) { 1444 */
1443 wake_up (dev->wait); 1445 if (waitqueue_active(&dev->wait)) {
1444 } 1446 if (dev->txq.qlen + dev->rxq.qlen + dev->done.qlen == 0)
1447 wake_up_all(&dev->wait);
1445 1448
1446 // or are we maybe short a few urbs? 1449 // or are we maybe short a few urbs?
1447 } else if (netif_running (dev->net) && 1450 } else if (netif_running (dev->net) &&
@@ -1580,6 +1583,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1580 dev->driver_name = name; 1583 dev->driver_name = name;
1581 dev->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV 1584 dev->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV
1582 | NETIF_MSG_PROBE | NETIF_MSG_LINK); 1585 | NETIF_MSG_PROBE | NETIF_MSG_LINK);
1586 init_waitqueue_head(&dev->wait);
1583 skb_queue_head_init (&dev->rxq); 1587 skb_queue_head_init (&dev->rxq);
1584 skb_queue_head_init (&dev->txq); 1588 skb_queue_head_init (&dev->txq);
1585 skb_queue_head_init (&dev->done); 1589 skb_queue_head_init (&dev->done);
@@ -1791,9 +1795,10 @@ int usbnet_resume (struct usb_interface *intf)
1791 spin_unlock_irq(&dev->txq.lock); 1795 spin_unlock_irq(&dev->txq.lock);
1792 1796
1793 if (test_bit(EVENT_DEV_OPEN, &dev->flags)) { 1797 if (test_bit(EVENT_DEV_OPEN, &dev->flags)) {
1794 /* handle remote wakeup ASAP */ 1798 /* handle remote wakeup ASAP
1795 if (!dev->wait && 1799 * we cannot race against stop
1796 netif_device_present(dev->net) && 1800 */
1801 if (netif_device_present(dev->net) &&
1797 !timer_pending(&dev->delay) && 1802 !timer_pending(&dev->delay) &&
1798 !test_bit(EVENT_RX_HALT, &dev->flags)) 1803 !test_bit(EVENT_RX_HALT, &dev->flags))
1799 rx_alloc_submit(dev, GFP_NOIO); 1804 rx_alloc_submit(dev, GFP_NOIO);
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index e1c77d4b80e4..b4a10bcb66a0 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -278,7 +278,10 @@ static void veth_setup(struct net_device *dev)
278 dev->features |= NETIF_F_LLTX; 278 dev->features |= NETIF_F_LLTX;
279 dev->features |= VETH_FEATURES; 279 dev->features |= VETH_FEATURES;
280 dev->vlan_features = dev->features & 280 dev->vlan_features = dev->features &
281 ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX); 281 ~(NETIF_F_HW_VLAN_CTAG_TX |
282 NETIF_F_HW_VLAN_STAG_TX |
283 NETIF_F_HW_VLAN_CTAG_RX |
284 NETIF_F_HW_VLAN_STAG_RX);
282 dev->destructor = veth_dev_free; 285 dev->destructor = veth_dev_free;
283 286
284 dev->hw_features = VETH_FEATURES; 287 dev->hw_features = VETH_FEATURES;
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 99fa48c941c6..6f15d9b315a1 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -671,8 +671,7 @@ static bool try_fill_recv(struct receive_queue *rq, gfp_t gfp)
671 if (err) 671 if (err)
672 break; 672 break;
673 } while (rq->vq->num_free); 673 } while (rq->vq->num_free);
674 if (unlikely(!virtqueue_kick(rq->vq))) 674 virtqueue_kick(rq->vq);
675 return false;
676 return !oom; 675 return !oom;
677} 676}
678 677
@@ -877,7 +876,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
877 err = xmit_skb(sq, skb); 876 err = xmit_skb(sq, skb);
878 877
879 /* This should not happen! */ 878 /* This should not happen! */
880 if (unlikely(err) || unlikely(!virtqueue_kick(sq->vq))) { 879 if (unlikely(err)) {
881 dev->stats.tx_fifo_errors++; 880 dev->stats.tx_fifo_errors++;
882 if (net_ratelimit()) 881 if (net_ratelimit())
883 dev_warn(&dev->dev, 882 dev_warn(&dev->dev,
@@ -886,6 +885,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
886 dev_kfree_skb_any(skb); 885 dev_kfree_skb_any(skb);
887 return NETDEV_TX_OK; 886 return NETDEV_TX_OK;
888 } 887 }
888 virtqueue_kick(sq->vq);
889 889
890 /* Don't wait up for transmitted skbs to be freed. */ 890 /* Don't wait up for transmitted skbs to be freed. */
891 skb_orphan(skb); 891 skb_orphan(skb);
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index a0fa5de210cf..e1e22e0f01e8 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -505,9 +505,13 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
505 r = -ENOBUFS; 505 r = -ENOBUFS;
506 goto err; 506 goto err;
507 } 507 }
508 d = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg, 508 r = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg,
509 ARRAY_SIZE(vq->iov) - seg, &out, 509 ARRAY_SIZE(vq->iov) - seg, &out,
510 &in, log, log_num); 510 &in, log, log_num);
511 if (unlikely(r < 0))
512 goto err;
513
514 d = r;
511 if (d == vq->num) { 515 if (d == vq->num) {
512 r = 0; 516 r = 0;
513 goto err; 517 goto err;
@@ -532,6 +536,12 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
532 *iovcount = seg; 536 *iovcount = seg;
533 if (unlikely(log)) 537 if (unlikely(log))
534 *log_num = nlogs; 538 *log_num = nlogs;
539
540 /* Detect overrun */
541 if (unlikely(datalen > 0)) {
542 r = UIO_MAXIOV + 1;
543 goto err;
544 }
535 return headcount; 545 return headcount;
536err: 546err:
537 vhost_discard_vq_desc(vq, headcount); 547 vhost_discard_vq_desc(vq, headcount);
@@ -587,6 +597,14 @@ static void handle_rx(struct vhost_net *net)
587 /* On error, stop handling until the next kick. */ 597 /* On error, stop handling until the next kick. */
588 if (unlikely(headcount < 0)) 598 if (unlikely(headcount < 0))
589 break; 599 break;
600 /* On overrun, truncate and discard */
601 if (unlikely(headcount > UIO_MAXIOV)) {
602 msg.msg_iovlen = 1;
603 err = sock->ops->recvmsg(NULL, sock, &msg,
604 1, MSG_DONTWAIT | MSG_TRUNC);
605 pr_debug("Discarded rx packet: len %zd\n", sock_len);
606 continue;
607 }
590 /* OK, now we need to know about added descriptors. */ 608 /* OK, now we need to know about added descriptors. */
591 if (!headcount) { 609 if (!headcount) {
592 if (unlikely(vhost_enable_notify(&net->dev, vq))) { 610 if (unlikely(vhost_enable_notify(&net->dev, vq))) {
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 37d06ea624aa..61a6ac8fa8fc 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -399,11 +399,25 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
399 state = BP_EAGAIN; 399 state = BP_EAGAIN;
400 break; 400 break;
401 } 401 }
402 scrub_page(page);
402 403
403 pfn = page_to_pfn(page); 404 frame_list[i] = page_to_pfn(page);
404 frame_list[i] = pfn_to_mfn(pfn); 405 }
405 406
406 scrub_page(page); 407 /*
408 * Ensure that ballooned highmem pages don't have kmaps.
409 *
410 * Do this before changing the p2m as kmap_flush_unused()
411 * reads PTEs to obtain pages (and hence needs the original
412 * p2m entry).
413 */
414 kmap_flush_unused();
415
416 /* Update direct mapping, invalidate P2M, and add to balloon. */
417 for (i = 0; i < nr_pages; i++) {
418 pfn = frame_list[i];
419 frame_list[i] = pfn_to_mfn(pfn);
420 page = pfn_to_page(pfn);
407 421
408#ifdef CONFIG_XEN_HAVE_PVMMU 422#ifdef CONFIG_XEN_HAVE_PVMMU
409 /* 423 /*
@@ -429,11 +443,9 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
429 } 443 }
430#endif 444#endif
431 445
432 balloon_append(pfn_to_page(pfn)); 446 balloon_append(page);
433 } 447 }
434 448
435 /* Ensure that ballooned highmem pages don't have kmaps. */
436 kmap_flush_unused();
437 flush_tlb_all(); 449 flush_tlb_all();
438 450
439 set_xen_guest_handle(reservation.extent_start, frame_list); 451 set_xen_guest_handle(reservation.extent_start, frame_list);
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 24084732b1d0..80ef38c73e5a 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -41,19 +41,8 @@ static const struct dentry_operations anon_inodefs_dentry_operations = {
41static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type, 41static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type,
42 int flags, const char *dev_name, void *data) 42 int flags, const char *dev_name, void *data)
43{ 43{
44 struct dentry *root; 44 return mount_pseudo(fs_type, "anon_inode:", NULL,
45 root = mount_pseudo(fs_type, "anon_inode:", NULL,
46 &anon_inodefs_dentry_operations, ANON_INODE_FS_MAGIC); 45 &anon_inodefs_dentry_operations, ANON_INODE_FS_MAGIC);
47 if (!IS_ERR(root)) {
48 struct super_block *s = root->d_sb;
49 anon_inode_inode = alloc_anon_inode(s);
50 if (IS_ERR(anon_inode_inode)) {
51 dput(root);
52 deactivate_locked_super(s);
53 root = ERR_CAST(anon_inode_inode);
54 }
55 }
56 return root;
57} 46}
58 47
59static struct file_system_type anon_inode_fs_type = { 48static struct file_system_type anon_inode_fs_type = {
@@ -175,22 +164,15 @@ EXPORT_SYMBOL_GPL(anon_inode_getfd);
175 164
176static int __init anon_inode_init(void) 165static int __init anon_inode_init(void)
177{ 166{
178 int error;
179
180 error = register_filesystem(&anon_inode_fs_type);
181 if (error)
182 goto err_exit;
183 anon_inode_mnt = kern_mount(&anon_inode_fs_type); 167 anon_inode_mnt = kern_mount(&anon_inode_fs_type);
184 if (IS_ERR(anon_inode_mnt)) { 168 if (IS_ERR(anon_inode_mnt))
185 error = PTR_ERR(anon_inode_mnt); 169 panic("anon_inode_init() kernel mount failed (%ld)\n", PTR_ERR(anon_inode_mnt));
186 goto err_unregister_filesystem;
187 }
188 return 0;
189 170
190err_unregister_filesystem: 171 anon_inode_inode = alloc_anon_inode(anon_inode_mnt->mnt_sb);
191 unregister_filesystem(&anon_inode_fs_type); 172 if (IS_ERR(anon_inode_inode))
192err_exit: 173 panic("anon_inode_init() inode allocation failed (%ld)\n", PTR_ERR(anon_inode_inode));
193 panic(KERN_ERR "anon_inode_init() failed (%d)\n", error); 174
175 return 0;
194} 176}
195 177
196fs_initcall(anon_inode_init); 178fs_initcall(anon_inode_init);
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
index 1324e6600e57..ca5ce14cbddc 100644
--- a/fs/ocfs2/stackglue.c
+++ b/fs/ocfs2/stackglue.c
@@ -346,7 +346,9 @@ int ocfs2_cluster_connect(const char *stack_name,
346 346
347 strlcpy(new_conn->cc_name, group, GROUP_NAME_MAX + 1); 347 strlcpy(new_conn->cc_name, group, GROUP_NAME_MAX + 1);
348 new_conn->cc_namelen = grouplen; 348 new_conn->cc_namelen = grouplen;
349 strlcpy(new_conn->cc_cluster_name, cluster_name, CLUSTER_NAME_MAX + 1); 349 if (cluster_name_len)
350 strlcpy(new_conn->cc_cluster_name, cluster_name,
351 CLUSTER_NAME_MAX + 1);
350 new_conn->cc_cluster_name_len = cluster_name_len; 352 new_conn->cc_cluster_name_len = cluster_name_len;
351 new_conn->cc_recovery_handler = recovery_handler; 353 new_conn->cc_recovery_handler = recovery_handler;
352 new_conn->cc_recovery_data = recovery_data; 354 new_conn->cc_recovery_data = recovery_data;
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 1005ebf17575..5a09a48f2658 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -163,4 +163,11 @@ enum {
163/* changeable features with no special hardware requirements */ 163/* changeable features with no special hardware requirements */
164#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO) 164#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
165 165
166#define NETIF_F_VLAN_FEATURES (NETIF_F_HW_VLAN_CTAG_FILTER | \
167 NETIF_F_HW_VLAN_CTAG_RX | \
168 NETIF_F_HW_VLAN_CTAG_TX | \
169 NETIF_F_HW_VLAN_STAG_FILTER | \
170 NETIF_F_HW_VLAN_STAG_RX | \
171 NETIF_F_HW_VLAN_STAG_TX)
172
166#endif /* _LINUX_NETDEV_FEATURES_H */ 173#endif /* _LINUX_NETDEV_FEATURES_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4cd5e9e13c87..06287c110241 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3097,7 +3097,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
3097{ 3097{
3098 return __skb_gso_segment(skb, features, true); 3098 return __skb_gso_segment(skb, features, true);
3099} 3099}
3100__be16 skb_network_protocol(struct sk_buff *skb); 3100__be16 skb_network_protocol(struct sk_buff *skb, int *depth);
3101 3101
3102static inline bool can_checksum_protocol(netdev_features_t features, 3102static inline bool can_checksum_protocol(netdev_features_t features,
3103 __be16 protocol) 3103 __be16 protocol)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index aa2c22cb8158..18ef0224fb6a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2508,8 +2508,8 @@ int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
2508 unsigned int flags); 2508 unsigned int flags);
2509void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); 2509void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
2510unsigned int skb_zerocopy_headlen(const struct sk_buff *from); 2510unsigned int skb_zerocopy_headlen(const struct sk_buff *from);
2511void skb_zerocopy(struct sk_buff *to, const struct sk_buff *from, 2511int skb_zerocopy(struct sk_buff *to, struct sk_buff *from,
2512 int len, int hlen); 2512 int len, int hlen);
2513void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len); 2513void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len);
2514int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen); 2514int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);
2515void skb_scrub_packet(struct sk_buff *skb, bool xnet); 2515void skb_scrub_packet(struct sk_buff *skb, bool xnet);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index e303eef94dd5..0662e98fef72 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -30,7 +30,7 @@ struct usbnet {
30 struct driver_info *driver_info; 30 struct driver_info *driver_info;
31 const char *driver_name; 31 const char *driver_name;
32 void *driver_priv; 32 void *driver_priv;
33 wait_queue_head_t *wait; 33 wait_queue_head_t wait;
34 struct mutex phy_mutex; 34 struct mutex phy_mutex;
35 unsigned char suspend_count; 35 unsigned char suspend_count;
36 unsigned char pkt_cnt, pkt_err; 36 unsigned char pkt_cnt, pkt_err;
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 9650a3ffd2d2..b4956a5fcc3f 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -31,8 +31,10 @@
31#define IF_PREFIX_AUTOCONF 0x02 31#define IF_PREFIX_AUTOCONF 0x02
32 32
33enum { 33enum {
34 INET6_IFADDR_STATE_PREDAD,
34 INET6_IFADDR_STATE_DAD, 35 INET6_IFADDR_STATE_DAD,
35 INET6_IFADDR_STATE_POSTDAD, 36 INET6_IFADDR_STATE_POSTDAD,
37 INET6_IFADDR_STATE_ERRDAD,
36 INET6_IFADDR_STATE_UP, 38 INET6_IFADDR_STATE_UP,
37 INET6_IFADDR_STATE_DEAD, 39 INET6_IFADDR_STATE_DEAD,
38}; 40};
@@ -58,7 +60,7 @@ struct inet6_ifaddr {
58 unsigned long cstamp; /* created timestamp */ 60 unsigned long cstamp; /* created timestamp */
59 unsigned long tstamp; /* updated timestamp */ 61 unsigned long tstamp; /* updated timestamp */
60 62
61 struct timer_list dad_timer; 63 struct delayed_work dad_work;
62 64
63 struct inet6_dev *idev; 65 struct inet6_dev *idev;
64 struct rt6_info *rt; 66 struct rt6_info *rt;
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 815c878f409b..24c1f2382557 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1600,15 +1600,31 @@ void trace_buffer_unlock_commit(struct ring_buffer *buffer,
1600} 1600}
1601EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit); 1601EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit);
1602 1602
1603static struct ring_buffer *temp_buffer;
1604
1603struct ring_buffer_event * 1605struct ring_buffer_event *
1604trace_event_buffer_lock_reserve(struct ring_buffer **current_rb, 1606trace_event_buffer_lock_reserve(struct ring_buffer **current_rb,
1605 struct ftrace_event_file *ftrace_file, 1607 struct ftrace_event_file *ftrace_file,
1606 int type, unsigned long len, 1608 int type, unsigned long len,
1607 unsigned long flags, int pc) 1609 unsigned long flags, int pc)
1608{ 1610{
1611 struct ring_buffer_event *entry;
1612
1609 *current_rb = ftrace_file->tr->trace_buffer.buffer; 1613 *current_rb = ftrace_file->tr->trace_buffer.buffer;
1610 return trace_buffer_lock_reserve(*current_rb, 1614 entry = trace_buffer_lock_reserve(*current_rb,
1611 type, len, flags, pc); 1615 type, len, flags, pc);
1616 /*
1617 * If tracing is off, but we have triggers enabled
1618 * we still need to look at the event data. Use the temp_buffer
1619 * to store the trace event for the tigger to use. It's recusive
1620 * safe and will not be recorded anywhere.
1621 */
1622 if (!entry && ftrace_file->flags & FTRACE_EVENT_FL_TRIGGER_COND) {
1623 *current_rb = temp_buffer;
1624 entry = trace_buffer_lock_reserve(*current_rb,
1625 type, len, flags, pc);
1626 }
1627 return entry;
1612} 1628}
1613EXPORT_SYMBOL_GPL(trace_event_buffer_lock_reserve); 1629EXPORT_SYMBOL_GPL(trace_event_buffer_lock_reserve);
1614 1630
@@ -6494,11 +6510,16 @@ __init static int tracer_alloc_buffers(void)
6494 6510
6495 raw_spin_lock_init(&global_trace.start_lock); 6511 raw_spin_lock_init(&global_trace.start_lock);
6496 6512
6513 /* Used for event triggers */
6514 temp_buffer = ring_buffer_alloc(PAGE_SIZE, RB_FL_OVERWRITE);
6515 if (!temp_buffer)
6516 goto out_free_cpumask;
6517
6497 /* TODO: make the number of buffers hot pluggable with CPUS */ 6518 /* TODO: make the number of buffers hot pluggable with CPUS */
6498 if (allocate_trace_buffers(&global_trace, ring_buf_size) < 0) { 6519 if (allocate_trace_buffers(&global_trace, ring_buf_size) < 0) {
6499 printk(KERN_ERR "tracer: failed to allocate ring buffer!\n"); 6520 printk(KERN_ERR "tracer: failed to allocate ring buffer!\n");
6500 WARN_ON(1); 6521 WARN_ON(1);
6501 goto out_free_cpumask; 6522 goto out_free_temp_buffer;
6502 } 6523 }
6503 6524
6504 if (global_trace.buffer_disabled) 6525 if (global_trace.buffer_disabled)
@@ -6540,6 +6561,8 @@ __init static int tracer_alloc_buffers(void)
6540 6561
6541 return 0; 6562 return 0;
6542 6563
6564out_free_temp_buffer:
6565 ring_buffer_free(temp_buffer);
6543out_free_cpumask: 6566out_free_cpumask:
6544 free_percpu(global_trace.trace_buffer.data); 6567 free_percpu(global_trace.trace_buffer.data);
6545#ifdef CONFIG_TRACER_MAX_TRACE 6568#ifdef CONFIG_TRACER_MAX_TRACE
diff --git a/lib/random32.c b/lib/random32.c
index 1e5b2df44291..614896778700 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -244,8 +244,19 @@ static void __prandom_reseed(bool late)
244 static bool latch = false; 244 static bool latch = false;
245 static DEFINE_SPINLOCK(lock); 245 static DEFINE_SPINLOCK(lock);
246 246
247 /* Asking for random bytes might result in bytes getting
248 * moved into the nonblocking pool and thus marking it
249 * as initialized. In this case we would double back into
250 * this function and attempt to do a late reseed.
251 * Ignore the pointless attempt to reseed again if we're
252 * already waiting for bytes when the nonblocking pool
253 * got initialized.
254 */
255
247 /* only allow initial seeding (late == false) once */ 256 /* only allow initial seeding (late == false) once */
248 spin_lock_irqsave(&lock, flags); 257 if (!spin_trylock_irqsave(&lock, flags))
258 return;
259
249 if (latch && !late) 260 if (latch && !late)
250 goto out; 261 goto out;
251 latch = true; 262 latch = true;
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index ec9909935fb6..175273f38cb1 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -307,9 +307,11 @@ static void vlan_sync_address(struct net_device *dev,
307static void vlan_transfer_features(struct net_device *dev, 307static void vlan_transfer_features(struct net_device *dev,
308 struct net_device *vlandev) 308 struct net_device *vlandev)
309{ 309{
310 struct vlan_dev_priv *vlan = vlan_dev_priv(vlandev);
311
310 vlandev->gso_max_size = dev->gso_max_size; 312 vlandev->gso_max_size = dev->gso_max_size;
311 313
312 if (dev->features & NETIF_F_HW_VLAN_CTAG_TX) 314 if (vlan_hw_offload_capable(dev->features, vlan->vlan_proto))
313 vlandev->hard_header_len = dev->hard_header_len; 315 vlandev->hard_header_len = dev->hard_header_len;
314 else 316 else
315 vlandev->hard_header_len = dev->hard_header_len + VLAN_HLEN; 317 vlandev->hard_header_len = dev->hard_header_len + VLAN_HLEN;
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index a78bebeca4d9..6f142f03716d 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -578,6 +578,9 @@ static int vlan_dev_init(struct net_device *dev)
578 578
579 dev->features |= real_dev->vlan_features | NETIF_F_LLTX; 579 dev->features |= real_dev->vlan_features | NETIF_F_LLTX;
580 dev->gso_max_size = real_dev->gso_max_size; 580 dev->gso_max_size = real_dev->gso_max_size;
581 if (dev->features & NETIF_F_VLAN_FEATURES)
582 netdev_warn(real_dev, "VLAN features are set incorrectly. Q-in-Q configurations may not work correctly.\n");
583
581 584
582 /* ipv6 shared card related stuff */ 585 /* ipv6 shared card related stuff */
583 dev->dev_id = real_dev->dev_id; 586 dev->dev_id = real_dev->dev_id;
@@ -592,7 +595,8 @@ static int vlan_dev_init(struct net_device *dev)
592#endif 595#endif
593 596
594 dev->needed_headroom = real_dev->needed_headroom; 597 dev->needed_headroom = real_dev->needed_headroom;
595 if (real_dev->features & NETIF_F_HW_VLAN_CTAG_TX) { 598 if (vlan_hw_offload_capable(real_dev->features,
599 vlan_dev_priv(dev)->vlan_proto)) {
596 dev->header_ops = &vlan_passthru_header_ops; 600 dev->header_ops = &vlan_passthru_header_ops;
597 dev->hard_header_len = real_dev->hard_header_len; 601 dev->hard_header_len = real_dev->hard_header_len;
598 } else { 602 } else {
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 0dd01a05bd59..3e2da2cb72db 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -49,14 +49,14 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
49 brstats->tx_bytes += skb->len; 49 brstats->tx_bytes += skb->len;
50 u64_stats_update_end(&brstats->syncp); 50 u64_stats_update_end(&brstats->syncp);
51 51
52 if (!br_allowed_ingress(br, br_get_vlan_info(br), skb, &vid))
53 goto out;
54
55 BR_INPUT_SKB_CB(skb)->brdev = dev; 52 BR_INPUT_SKB_CB(skb)->brdev = dev;
56 53
57 skb_reset_mac_header(skb); 54 skb_reset_mac_header(skb);
58 skb_pull(skb, ETH_HLEN); 55 skb_pull(skb, ETH_HLEN);
59 56
57 if (!br_allowed_ingress(br, br_get_vlan_info(br), skb, &vid))
58 goto out;
59
60 if (is_broadcast_ether_addr(dest)) 60 if (is_broadcast_ether_addr(dest))
61 br_flood_deliver(br, skb, false); 61 br_flood_deliver(br, skb, false);
62 else if (is_multicast_ether_addr(dest)) { 62 else if (is_multicast_ether_addr(dest)) {
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 28d544627422..d0cca3c65f01 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -29,6 +29,7 @@ static int br_pass_frame_up(struct sk_buff *skb)
29 struct net_device *indev, *brdev = BR_INPUT_SKB_CB(skb)->brdev; 29 struct net_device *indev, *brdev = BR_INPUT_SKB_CB(skb)->brdev;
30 struct net_bridge *br = netdev_priv(brdev); 30 struct net_bridge *br = netdev_priv(brdev);
31 struct pcpu_sw_netstats *brstats = this_cpu_ptr(br->stats); 31 struct pcpu_sw_netstats *brstats = this_cpu_ptr(br->stats);
32 struct net_port_vlans *pv;
32 33
33 u64_stats_update_begin(&brstats->syncp); 34 u64_stats_update_begin(&brstats->syncp);
34 brstats->rx_packets++; 35 brstats->rx_packets++;
@@ -39,18 +40,18 @@ static int br_pass_frame_up(struct sk_buff *skb)
39 * packet is allowed except in promisc modue when someone 40 * packet is allowed except in promisc modue when someone
40 * may be running packet capture. 41 * may be running packet capture.
41 */ 42 */
43 pv = br_get_vlan_info(br);
42 if (!(brdev->flags & IFF_PROMISC) && 44 if (!(brdev->flags & IFF_PROMISC) &&
43 !br_allowed_egress(br, br_get_vlan_info(br), skb)) { 45 !br_allowed_egress(br, pv, skb)) {
44 kfree_skb(skb); 46 kfree_skb(skb);
45 return NET_RX_DROP; 47 return NET_RX_DROP;
46 } 48 }
47 49
48 skb = br_handle_vlan(br, br_get_vlan_info(br), skb);
49 if (!skb)
50 return NET_RX_DROP;
51
52 indev = skb->dev; 50 indev = skb->dev;
53 skb->dev = brdev; 51 skb->dev = brdev;
52 skb = br_handle_vlan(br, pv, skb);
53 if (!skb)
54 return NET_RX_DROP;
54 55
55 return NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, indev, NULL, 56 return NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, indev, NULL,
56 netif_receive_skb); 57 netif_receive_skb);
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 5d5b101be102..91510712c7a7 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -119,22 +119,6 @@ static void __vlan_flush(struct net_port_vlans *v)
119 kfree_rcu(v, rcu); 119 kfree_rcu(v, rcu);
120} 120}
121 121
122/* Strip the tag from the packet. Will return skb with tci set 0. */
123static struct sk_buff *br_vlan_untag(struct sk_buff *skb)
124{
125 if (skb->protocol != htons(ETH_P_8021Q)) {
126 skb->vlan_tci = 0;
127 return skb;
128 }
129
130 skb->vlan_tci = 0;
131 skb = vlan_untag(skb);
132 if (skb)
133 skb->vlan_tci = 0;
134
135 return skb;
136}
137
138struct sk_buff *br_handle_vlan(struct net_bridge *br, 122struct sk_buff *br_handle_vlan(struct net_bridge *br,
139 const struct net_port_vlans *pv, 123 const struct net_port_vlans *pv,
140 struct sk_buff *skb) 124 struct sk_buff *skb)
@@ -144,13 +128,27 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br,
144 if (!br->vlan_enabled) 128 if (!br->vlan_enabled)
145 goto out; 129 goto out;
146 130
131 /* Vlan filter table must be configured at this point. The
132 * only exception is the bridge is set in promisc mode and the
133 * packet is destined for the bridge device. In this case
134 * pass the packet as is.
135 */
136 if (!pv) {
137 if ((br->dev->flags & IFF_PROMISC) && skb->dev == br->dev) {
138 goto out;
139 } else {
140 kfree_skb(skb);
141 return NULL;
142 }
143 }
144
147 /* At this point, we know that the frame was filtered and contains 145 /* At this point, we know that the frame was filtered and contains
148 * a valid vlan id. If the vlan id is set in the untagged bitmap, 146 * a valid vlan id. If the vlan id is set in the untagged bitmap,
149 * send untagged; otherwise, send tagged. 147 * send untagged; otherwise, send tagged.
150 */ 148 */
151 br_vlan_get_tag(skb, &vid); 149 br_vlan_get_tag(skb, &vid);
152 if (test_bit(vid, pv->untagged_bitmap)) 150 if (test_bit(vid, pv->untagged_bitmap))
153 skb = br_vlan_untag(skb); 151 skb->vlan_tci = 0;
154 152
155out: 153out:
156 return skb; 154 return skb;
@@ -174,6 +172,18 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
174 if (!v) 172 if (!v)
175 return false; 173 return false;
176 174
175 /* If vlan tx offload is disabled on bridge device and frame was
176 * sent from vlan device on the bridge device, it does not have
177 * HW accelerated vlan tag.
178 */
179 if (unlikely(!vlan_tx_tag_present(skb) &&
180 (skb->protocol == htons(ETH_P_8021Q) ||
181 skb->protocol == htons(ETH_P_8021AD)))) {
182 skb = vlan_untag(skb);
183 if (unlikely(!skb))
184 return false;
185 }
186
177 err = br_vlan_get_tag(skb, vid); 187 err = br_vlan_get_tag(skb, vid);
178 if (!*vid) { 188 if (!*vid) {
179 u16 pvid = br_get_pvid(v); 189 u16 pvid = br_get_pvid(v);
diff --git a/net/core/dev.c b/net/core/dev.c
index 778b2036a9e7..cf92139b229c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2281,7 +2281,7 @@ out:
2281} 2281}
2282EXPORT_SYMBOL(skb_checksum_help); 2282EXPORT_SYMBOL(skb_checksum_help);
2283 2283
2284__be16 skb_network_protocol(struct sk_buff *skb) 2284__be16 skb_network_protocol(struct sk_buff *skb, int *depth)
2285{ 2285{
2286 __be16 type = skb->protocol; 2286 __be16 type = skb->protocol;
2287 int vlan_depth = ETH_HLEN; 2287 int vlan_depth = ETH_HLEN;
@@ -2308,6 +2308,8 @@ __be16 skb_network_protocol(struct sk_buff *skb)
2308 vlan_depth += VLAN_HLEN; 2308 vlan_depth += VLAN_HLEN;
2309 } 2309 }
2310 2310
2311 *depth = vlan_depth;
2312
2311 return type; 2313 return type;
2312} 2314}
2313 2315
@@ -2321,12 +2323,13 @@ struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
2321{ 2323{
2322 struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); 2324 struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT);
2323 struct packet_offload *ptype; 2325 struct packet_offload *ptype;
2324 __be16 type = skb_network_protocol(skb); 2326 int vlan_depth = skb->mac_len;
2327 __be16 type = skb_network_protocol(skb, &vlan_depth);
2325 2328
2326 if (unlikely(!type)) 2329 if (unlikely(!type))
2327 return ERR_PTR(-EINVAL); 2330 return ERR_PTR(-EINVAL);
2328 2331
2329 __skb_pull(skb, skb->mac_len); 2332 __skb_pull(skb, vlan_depth);
2330 2333
2331 rcu_read_lock(); 2334 rcu_read_lock();
2332 list_for_each_entry_rcu(ptype, &offload_base, list) { 2335 list_for_each_entry_rcu(ptype, &offload_base, list) {
@@ -2493,8 +2496,10 @@ static netdev_features_t harmonize_features(struct sk_buff *skb,
2493 const struct net_device *dev, 2496 const struct net_device *dev,
2494 netdev_features_t features) 2497 netdev_features_t features)
2495{ 2498{
2499 int tmp;
2500
2496 if (skb->ip_summed != CHECKSUM_NONE && 2501 if (skb->ip_summed != CHECKSUM_NONE &&
2497 !can_checksum_protocol(features, skb_network_protocol(skb))) { 2502 !can_checksum_protocol(features, skb_network_protocol(skb, &tmp))) {
2498 features &= ~NETIF_F_ALL_CSUM; 2503 features &= ~NETIF_F_ALL_CSUM;
2499 } else if (illegal_highdma(dev, skb)) { 2504 } else if (illegal_highdma(dev, skb)) {
2500 features &= ~NETIF_F_SG; 2505 features &= ~NETIF_F_SG;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 3f14c638c2b1..30c7d35dd862 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2127,25 +2127,31 @@ EXPORT_SYMBOL_GPL(skb_zerocopy_headlen);
2127 * 2127 *
2128 * The `hlen` as calculated by skb_zerocopy_headlen() specifies the 2128 * The `hlen` as calculated by skb_zerocopy_headlen() specifies the
2129 * headroom in the `to` buffer. 2129 * headroom in the `to` buffer.
2130 *
2131 * Return value:
2132 * 0: everything is OK
2133 * -ENOMEM: couldn't orphan frags of @from due to lack of memory
2134 * -EFAULT: skb_copy_bits() found some problem with skb geometry
2130 */ 2135 */
2131void 2136int
2132skb_zerocopy(struct sk_buff *to, const struct sk_buff *from, int len, int hlen) 2137skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len, int hlen)
2133{ 2138{
2134 int i, j = 0; 2139 int i, j = 0;
2135 int plen = 0; /* length of skb->head fragment */ 2140 int plen = 0; /* length of skb->head fragment */
2141 int ret;
2136 struct page *page; 2142 struct page *page;
2137 unsigned int offset; 2143 unsigned int offset;
2138 2144
2139 BUG_ON(!from->head_frag && !hlen); 2145 BUG_ON(!from->head_frag && !hlen);
2140 2146
2141 /* dont bother with small payloads */ 2147 /* dont bother with small payloads */
2142 if (len <= skb_tailroom(to)) { 2148 if (len <= skb_tailroom(to))
2143 skb_copy_bits(from, 0, skb_put(to, len), len); 2149 return skb_copy_bits(from, 0, skb_put(to, len), len);
2144 return;
2145 }
2146 2150
2147 if (hlen) { 2151 if (hlen) {
2148 skb_copy_bits(from, 0, skb_put(to, hlen), hlen); 2152 ret = skb_copy_bits(from, 0, skb_put(to, hlen), hlen);
2153 if (unlikely(ret))
2154 return ret;
2149 len -= hlen; 2155 len -= hlen;
2150 } else { 2156 } else {
2151 plen = min_t(int, skb_headlen(from), len); 2157 plen = min_t(int, skb_headlen(from), len);
@@ -2163,6 +2169,11 @@ skb_zerocopy(struct sk_buff *to, const struct sk_buff *from, int len, int hlen)
2163 to->len += len + plen; 2169 to->len += len + plen;
2164 to->data_len += len + plen; 2170 to->data_len += len + plen;
2165 2171
2172 if (unlikely(skb_orphan_frags(from, GFP_ATOMIC))) {
2173 skb_tx_error(from);
2174 return -ENOMEM;
2175 }
2176
2166 for (i = 0; i < skb_shinfo(from)->nr_frags; i++) { 2177 for (i = 0; i < skb_shinfo(from)->nr_frags; i++) {
2167 if (!len) 2178 if (!len)
2168 break; 2179 break;
@@ -2173,6 +2184,8 @@ skb_zerocopy(struct sk_buff *to, const struct sk_buff *from, int len, int hlen)
2173 j++; 2184 j++;
2174 } 2185 }
2175 skb_shinfo(to)->nr_frags = j; 2186 skb_shinfo(to)->nr_frags = j;
2187
2188 return 0;
2176} 2189}
2177EXPORT_SYMBOL_GPL(skb_zerocopy); 2190EXPORT_SYMBOL_GPL(skb_zerocopy);
2178 2191
@@ -2866,8 +2879,9 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
2866 int err = -ENOMEM; 2879 int err = -ENOMEM;
2867 int i = 0; 2880 int i = 0;
2868 int pos; 2881 int pos;
2882 int dummy;
2869 2883
2870 proto = skb_network_protocol(head_skb); 2884 proto = skb_network_protocol(head_skb, &dummy);
2871 if (unlikely(!proto)) 2885 if (unlikely(!proto))
2872 return ERR_PTR(-EINVAL); 2886 return ERR_PTR(-EINVAL);
2873 2887
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index 1863422fb7d5..250be7421ab3 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -182,6 +182,14 @@ static int gre_cisco_rcv(struct sk_buff *skb)
182 int i; 182 int i;
183 bool csum_err = false; 183 bool csum_err = false;
184 184
185#ifdef CONFIG_NET_IPGRE_BROADCAST
186 if (ipv4_is_multicast(ip_hdr(skb)->daddr)) {
187 /* Looped back packet, drop it! */
188 if (rt_is_output_route(skb_rtable(skb)))
189 goto drop;
190 }
191#endif
192
185 if (parse_gre_header(skb, &tpi, &csum_err) < 0) 193 if (parse_gre_header(skb, &tpi, &csum_err) < 0)
186 goto drop; 194 goto drop;
187 195
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 66aaf506fbef..e77381d1df9a 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -420,9 +420,6 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
420 420
421#ifdef CONFIG_NET_IPGRE_BROADCAST 421#ifdef CONFIG_NET_IPGRE_BROADCAST
422 if (ipv4_is_multicast(iph->daddr)) { 422 if (ipv4_is_multicast(iph->daddr)) {
423 /* Looped back packet, drop it! */
424 if (rt_is_output_route(skb_rtable(skb)))
425 goto drop;
426 tunnel->dev->stats.multicast++; 423 tunnel->dev->stats.multicast++;
427 skb->pkt_type = PACKET_BROADCAST; 424 skb->pkt_type = PACKET_BROADCAST;
428 } 425 }
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index b86f0a37fa7c..e0c2b1d2ea4e 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -108,6 +108,7 @@ int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto)
108 nf_reset(skb); 108 nf_reset(skb);
109 secpath_reset(skb); 109 secpath_reset(skb);
110 skb_clear_hash_if_not_l4(skb); 110 skb_clear_hash_if_not_l4(skb);
111 skb_dst_drop(skb);
111 skb->vlan_tci = 0; 112 skb->vlan_tci = 0;
112 skb_set_queue_mapping(skb, 0); 113 skb_set_queue_mapping(skb, 0);
113 skb->pkt_type = PACKET_HOST; 114 skb->pkt_type = PACKET_HOST;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 4555244607d0..6379894ec210 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2628,7 +2628,7 @@ static void get_timewait4_sock(const struct inet_timewait_sock *tw,
2628{ 2628{
2629 __be32 dest, src; 2629 __be32 dest, src;
2630 __u16 destp, srcp; 2630 __u16 destp, srcp;
2631 long delta = tw->tw_ttd - jiffies; 2631 s32 delta = tw->tw_ttd - inet_tw_time_stamp();
2632 2632
2633 dest = tw->tw_daddr; 2633 dest = tw->tw_daddr;
2634 src = tw->tw_rcv_saddr; 2634 src = tw->tw_rcv_saddr;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 344e972426df..6c7fa0853fc7 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -133,10 +133,12 @@ static int ipv6_count_addresses(struct inet6_dev *idev);
133static struct hlist_head inet6_addr_lst[IN6_ADDR_HSIZE]; 133static struct hlist_head inet6_addr_lst[IN6_ADDR_HSIZE];
134static DEFINE_SPINLOCK(addrconf_hash_lock); 134static DEFINE_SPINLOCK(addrconf_hash_lock);
135 135
136static void addrconf_verify(unsigned long); 136static void addrconf_verify(void);
137static void addrconf_verify_rtnl(void);
138static void addrconf_verify_work(struct work_struct *);
137 139
138static DEFINE_TIMER(addr_chk_timer, addrconf_verify, 0, 0); 140static struct workqueue_struct *addrconf_wq;
139static DEFINE_SPINLOCK(addrconf_verify_lock); 141static DECLARE_DELAYED_WORK(addr_chk_work, addrconf_verify_work);
140 142
141static void addrconf_join_anycast(struct inet6_ifaddr *ifp); 143static void addrconf_join_anycast(struct inet6_ifaddr *ifp);
142static void addrconf_leave_anycast(struct inet6_ifaddr *ifp); 144static void addrconf_leave_anycast(struct inet6_ifaddr *ifp);
@@ -151,7 +153,7 @@ static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx,
151 u32 flags, u32 noflags); 153 u32 flags, u32 noflags);
152 154
153static void addrconf_dad_start(struct inet6_ifaddr *ifp); 155static void addrconf_dad_start(struct inet6_ifaddr *ifp);
154static void addrconf_dad_timer(unsigned long data); 156static void addrconf_dad_work(struct work_struct *w);
155static void addrconf_dad_completed(struct inet6_ifaddr *ifp); 157static void addrconf_dad_completed(struct inet6_ifaddr *ifp);
156static void addrconf_dad_run(struct inet6_dev *idev); 158static void addrconf_dad_run(struct inet6_dev *idev);
157static void addrconf_rs_timer(unsigned long data); 159static void addrconf_rs_timer(unsigned long data);
@@ -247,9 +249,9 @@ static void addrconf_del_rs_timer(struct inet6_dev *idev)
247 __in6_dev_put(idev); 249 __in6_dev_put(idev);
248} 250}
249 251
250static void addrconf_del_dad_timer(struct inet6_ifaddr *ifp) 252static void addrconf_del_dad_work(struct inet6_ifaddr *ifp)
251{ 253{
252 if (del_timer(&ifp->dad_timer)) 254 if (cancel_delayed_work(&ifp->dad_work))
253 __in6_ifa_put(ifp); 255 __in6_ifa_put(ifp);
254} 256}
255 257
@@ -261,12 +263,12 @@ static void addrconf_mod_rs_timer(struct inet6_dev *idev,
261 mod_timer(&idev->rs_timer, jiffies + when); 263 mod_timer(&idev->rs_timer, jiffies + when);
262} 264}
263 265
264static void addrconf_mod_dad_timer(struct inet6_ifaddr *ifp, 266static void addrconf_mod_dad_work(struct inet6_ifaddr *ifp,
265 unsigned long when) 267 unsigned long delay)
266{ 268{
267 if (!timer_pending(&ifp->dad_timer)) 269 if (!delayed_work_pending(&ifp->dad_work))
268 in6_ifa_hold(ifp); 270 in6_ifa_hold(ifp);
269 mod_timer(&ifp->dad_timer, jiffies + when); 271 mod_delayed_work(addrconf_wq, &ifp->dad_work, delay);
270} 272}
271 273
272static int snmp6_alloc_dev(struct inet6_dev *idev) 274static int snmp6_alloc_dev(struct inet6_dev *idev)
@@ -751,8 +753,9 @@ void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp)
751 753
752 in6_dev_put(ifp->idev); 754 in6_dev_put(ifp->idev);
753 755
754 if (del_timer(&ifp->dad_timer)) 756 if (cancel_delayed_work(&ifp->dad_work))
755 pr_notice("Timer is still running, when freeing ifa=%p\n", ifp); 757 pr_notice("delayed DAD work was pending while freeing ifa=%p\n",
758 ifp);
756 759
757 if (ifp->state != INET6_IFADDR_STATE_DEAD) { 760 if (ifp->state != INET6_IFADDR_STATE_DEAD) {
758 pr_warn("Freeing alive inet6 address %p\n", ifp); 761 pr_warn("Freeing alive inet6 address %p\n", ifp);
@@ -849,8 +852,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
849 852
850 spin_lock_init(&ifa->lock); 853 spin_lock_init(&ifa->lock);
851 spin_lock_init(&ifa->state_lock); 854 spin_lock_init(&ifa->state_lock);
852 setup_timer(&ifa->dad_timer, addrconf_dad_timer, 855 INIT_DELAYED_WORK(&ifa->dad_work, addrconf_dad_work);
853 (unsigned long)ifa);
854 INIT_HLIST_NODE(&ifa->addr_lst); 856 INIT_HLIST_NODE(&ifa->addr_lst);
855 ifa->scope = scope; 857 ifa->scope = scope;
856 ifa->prefix_len = pfxlen; 858 ifa->prefix_len = pfxlen;
@@ -990,6 +992,8 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
990 enum cleanup_prefix_rt_t action = CLEANUP_PREFIX_RT_NOP; 992 enum cleanup_prefix_rt_t action = CLEANUP_PREFIX_RT_NOP;
991 unsigned long expires; 993 unsigned long expires;
992 994
995 ASSERT_RTNL();
996
993 spin_lock_bh(&ifp->state_lock); 997 spin_lock_bh(&ifp->state_lock);
994 state = ifp->state; 998 state = ifp->state;
995 ifp->state = INET6_IFADDR_STATE_DEAD; 999 ifp->state = INET6_IFADDR_STATE_DEAD;
@@ -1021,7 +1025,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
1021 1025
1022 write_unlock_bh(&ifp->idev->lock); 1026 write_unlock_bh(&ifp->idev->lock);
1023 1027
1024 addrconf_del_dad_timer(ifp); 1028 addrconf_del_dad_work(ifp);
1025 1029
1026 ipv6_ifa_notify(RTM_DELADDR, ifp); 1030 ipv6_ifa_notify(RTM_DELADDR, ifp);
1027 1031
@@ -1604,7 +1608,7 @@ static void addrconf_dad_stop(struct inet6_ifaddr *ifp, int dad_failed)
1604{ 1608{
1605 if (ifp->flags&IFA_F_PERMANENT) { 1609 if (ifp->flags&IFA_F_PERMANENT) {
1606 spin_lock_bh(&ifp->lock); 1610 spin_lock_bh(&ifp->lock);
1607 addrconf_del_dad_timer(ifp); 1611 addrconf_del_dad_work(ifp);
1608 ifp->flags |= IFA_F_TENTATIVE; 1612 ifp->flags |= IFA_F_TENTATIVE;
1609 if (dad_failed) 1613 if (dad_failed)
1610 ifp->flags |= IFA_F_DADFAILED; 1614 ifp->flags |= IFA_F_DADFAILED;
@@ -1625,20 +1629,21 @@ static void addrconf_dad_stop(struct inet6_ifaddr *ifp, int dad_failed)
1625 spin_unlock_bh(&ifp->lock); 1629 spin_unlock_bh(&ifp->lock);
1626 } 1630 }
1627 ipv6_del_addr(ifp); 1631 ipv6_del_addr(ifp);
1628 } else 1632 } else {
1629 ipv6_del_addr(ifp); 1633 ipv6_del_addr(ifp);
1634 }
1630} 1635}
1631 1636
1632static int addrconf_dad_end(struct inet6_ifaddr *ifp) 1637static int addrconf_dad_end(struct inet6_ifaddr *ifp)
1633{ 1638{
1634 int err = -ENOENT; 1639 int err = -ENOENT;
1635 1640
1636 spin_lock(&ifp->state_lock); 1641 spin_lock_bh(&ifp->state_lock);
1637 if (ifp->state == INET6_IFADDR_STATE_DAD) { 1642 if (ifp->state == INET6_IFADDR_STATE_DAD) {
1638 ifp->state = INET6_IFADDR_STATE_POSTDAD; 1643 ifp->state = INET6_IFADDR_STATE_POSTDAD;
1639 err = 0; 1644 err = 0;
1640 } 1645 }
1641 spin_unlock(&ifp->state_lock); 1646 spin_unlock_bh(&ifp->state_lock);
1642 1647
1643 return err; 1648 return err;
1644} 1649}
@@ -1671,7 +1676,12 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp)
1671 } 1676 }
1672 } 1677 }
1673 1678
1674 addrconf_dad_stop(ifp, 1); 1679 spin_lock_bh(&ifp->state_lock);
1680 /* transition from _POSTDAD to _ERRDAD */
1681 ifp->state = INET6_IFADDR_STATE_ERRDAD;
1682 spin_unlock_bh(&ifp->state_lock);
1683
1684 addrconf_mod_dad_work(ifp, 0);
1675} 1685}
1676 1686
1677/* Join to solicited addr multicast group. */ 1687/* Join to solicited addr multicast group. */
@@ -1680,6 +1690,8 @@ void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr)
1680{ 1690{
1681 struct in6_addr maddr; 1691 struct in6_addr maddr;
1682 1692
1693 ASSERT_RTNL();
1694
1683 if (dev->flags&(IFF_LOOPBACK|IFF_NOARP)) 1695 if (dev->flags&(IFF_LOOPBACK|IFF_NOARP))
1684 return; 1696 return;
1685 1697
@@ -1691,6 +1703,8 @@ void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr)
1691{ 1703{
1692 struct in6_addr maddr; 1704 struct in6_addr maddr;
1693 1705
1706 ASSERT_RTNL();
1707
1694 if (idev->dev->flags&(IFF_LOOPBACK|IFF_NOARP)) 1708 if (idev->dev->flags&(IFF_LOOPBACK|IFF_NOARP))
1695 return; 1709 return;
1696 1710
@@ -1701,6 +1715,9 @@ void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr)
1701static void addrconf_join_anycast(struct inet6_ifaddr *ifp) 1715static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
1702{ 1716{
1703 struct in6_addr addr; 1717 struct in6_addr addr;
1718
1719 ASSERT_RTNL();
1720
1704 if (ifp->prefix_len >= 127) /* RFC 6164 */ 1721 if (ifp->prefix_len >= 127) /* RFC 6164 */
1705 return; 1722 return;
1706 ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len); 1723 ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
@@ -1712,6 +1729,9 @@ static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
1712static void addrconf_leave_anycast(struct inet6_ifaddr *ifp) 1729static void addrconf_leave_anycast(struct inet6_ifaddr *ifp)
1713{ 1730{
1714 struct in6_addr addr; 1731 struct in6_addr addr;
1732
1733 ASSERT_RTNL();
1734
1715 if (ifp->prefix_len >= 127) /* RFC 6164 */ 1735 if (ifp->prefix_len >= 127) /* RFC 6164 */
1716 return; 1736 return;
1717 ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len); 1737 ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
@@ -2271,11 +2291,13 @@ ok:
2271 return; 2291 return;
2272 } 2292 }
2273 2293
2274 ifp->flags |= IFA_F_MANAGETEMPADDR;
2275 update_lft = 0; 2294 update_lft = 0;
2276 create = 1; 2295 create = 1;
2296 spin_lock_bh(&ifp->lock);
2297 ifp->flags |= IFA_F_MANAGETEMPADDR;
2277 ifp->cstamp = jiffies; 2298 ifp->cstamp = jiffies;
2278 ifp->tokenized = tokenized; 2299 ifp->tokenized = tokenized;
2300 spin_unlock_bh(&ifp->lock);
2279 addrconf_dad_start(ifp); 2301 addrconf_dad_start(ifp);
2280 } 2302 }
2281 2303
@@ -2326,7 +2348,7 @@ ok:
2326 create, now); 2348 create, now);
2327 2349
2328 in6_ifa_put(ifp); 2350 in6_ifa_put(ifp);
2329 addrconf_verify(0); 2351 addrconf_verify();
2330 } 2352 }
2331 } 2353 }
2332 inet6_prefix_notify(RTM_NEWPREFIX, in6_dev, pinfo); 2354 inet6_prefix_notify(RTM_NEWPREFIX, in6_dev, pinfo);
@@ -2475,7 +2497,7 @@ static int inet6_addr_add(struct net *net, int ifindex,
2475 manage_tempaddrs(idev, ifp, valid_lft, prefered_lft, 2497 manage_tempaddrs(idev, ifp, valid_lft, prefered_lft,
2476 true, jiffies); 2498 true, jiffies);
2477 in6_ifa_put(ifp); 2499 in6_ifa_put(ifp);
2478 addrconf_verify(0); 2500 addrconf_verify_rtnl();
2479 return 0; 2501 return 0;
2480 } 2502 }
2481 2503
@@ -3011,7 +3033,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
3011 hlist_for_each_entry_rcu(ifa, h, addr_lst) { 3033 hlist_for_each_entry_rcu(ifa, h, addr_lst) {
3012 if (ifa->idev == idev) { 3034 if (ifa->idev == idev) {
3013 hlist_del_init_rcu(&ifa->addr_lst); 3035 hlist_del_init_rcu(&ifa->addr_lst);
3014 addrconf_del_dad_timer(ifa); 3036 addrconf_del_dad_work(ifa);
3015 goto restart; 3037 goto restart;
3016 } 3038 }
3017 } 3039 }
@@ -3049,7 +3071,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
3049 while (!list_empty(&idev->addr_list)) { 3071 while (!list_empty(&idev->addr_list)) {
3050 ifa = list_first_entry(&idev->addr_list, 3072 ifa = list_first_entry(&idev->addr_list,
3051 struct inet6_ifaddr, if_list); 3073 struct inet6_ifaddr, if_list);
3052 addrconf_del_dad_timer(ifa); 3074 addrconf_del_dad_work(ifa);
3053 3075
3054 list_del(&ifa->if_list); 3076 list_del(&ifa->if_list);
3055 3077
@@ -3148,10 +3170,10 @@ static void addrconf_dad_kick(struct inet6_ifaddr *ifp)
3148 rand_num = prandom_u32() % (idev->cnf.rtr_solicit_delay ? : 1); 3170 rand_num = prandom_u32() % (idev->cnf.rtr_solicit_delay ? : 1);
3149 3171
3150 ifp->dad_probes = idev->cnf.dad_transmits; 3172 ifp->dad_probes = idev->cnf.dad_transmits;
3151 addrconf_mod_dad_timer(ifp, rand_num); 3173 addrconf_mod_dad_work(ifp, rand_num);
3152} 3174}
3153 3175
3154static void addrconf_dad_start(struct inet6_ifaddr *ifp) 3176static void addrconf_dad_begin(struct inet6_ifaddr *ifp)
3155{ 3177{
3156 struct inet6_dev *idev = ifp->idev; 3178 struct inet6_dev *idev = ifp->idev;
3157 struct net_device *dev = idev->dev; 3179 struct net_device *dev = idev->dev;
@@ -3203,25 +3225,68 @@ out:
3203 read_unlock_bh(&idev->lock); 3225 read_unlock_bh(&idev->lock);
3204} 3226}
3205 3227
3206static void addrconf_dad_timer(unsigned long data) 3228static void addrconf_dad_start(struct inet6_ifaddr *ifp)
3207{ 3229{
3208 struct inet6_ifaddr *ifp = (struct inet6_ifaddr *) data; 3230 bool begin_dad = false;
3231
3232 spin_lock_bh(&ifp->state_lock);
3233 if (ifp->state != INET6_IFADDR_STATE_DEAD) {
3234 ifp->state = INET6_IFADDR_STATE_PREDAD;
3235 begin_dad = true;
3236 }
3237 spin_unlock_bh(&ifp->state_lock);
3238
3239 if (begin_dad)
3240 addrconf_mod_dad_work(ifp, 0);
3241}
3242
3243static void addrconf_dad_work(struct work_struct *w)
3244{
3245 struct inet6_ifaddr *ifp = container_of(to_delayed_work(w),
3246 struct inet6_ifaddr,
3247 dad_work);
3209 struct inet6_dev *idev = ifp->idev; 3248 struct inet6_dev *idev = ifp->idev;
3210 struct in6_addr mcaddr; 3249 struct in6_addr mcaddr;
3211 3250
3251 enum {
3252 DAD_PROCESS,
3253 DAD_BEGIN,
3254 DAD_ABORT,
3255 } action = DAD_PROCESS;
3256
3257 rtnl_lock();
3258
3259 spin_lock_bh(&ifp->state_lock);
3260 if (ifp->state == INET6_IFADDR_STATE_PREDAD) {
3261 action = DAD_BEGIN;
3262 ifp->state = INET6_IFADDR_STATE_DAD;
3263 } else if (ifp->state == INET6_IFADDR_STATE_ERRDAD) {
3264 action = DAD_ABORT;
3265 ifp->state = INET6_IFADDR_STATE_POSTDAD;
3266 }
3267 spin_unlock_bh(&ifp->state_lock);
3268
3269 if (action == DAD_BEGIN) {
3270 addrconf_dad_begin(ifp);
3271 goto out;
3272 } else if (action == DAD_ABORT) {
3273 addrconf_dad_stop(ifp, 1);
3274 goto out;
3275 }
3276
3212 if (!ifp->dad_probes && addrconf_dad_end(ifp)) 3277 if (!ifp->dad_probes && addrconf_dad_end(ifp))
3213 goto out; 3278 goto out;
3214 3279
3215 write_lock(&idev->lock); 3280 write_lock_bh(&idev->lock);
3216 if (idev->dead || !(idev->if_flags & IF_READY)) { 3281 if (idev->dead || !(idev->if_flags & IF_READY)) {
3217 write_unlock(&idev->lock); 3282 write_unlock_bh(&idev->lock);
3218 goto out; 3283 goto out;
3219 } 3284 }
3220 3285
3221 spin_lock(&ifp->lock); 3286 spin_lock(&ifp->lock);
3222 if (ifp->state == INET6_IFADDR_STATE_DEAD) { 3287 if (ifp->state == INET6_IFADDR_STATE_DEAD) {
3223 spin_unlock(&ifp->lock); 3288 spin_unlock(&ifp->lock);
3224 write_unlock(&idev->lock); 3289 write_unlock_bh(&idev->lock);
3225 goto out; 3290 goto out;
3226 } 3291 }
3227 3292
@@ -3232,7 +3297,7 @@ static void addrconf_dad_timer(unsigned long data)
3232 3297
3233 ifp->flags &= ~(IFA_F_TENTATIVE|IFA_F_OPTIMISTIC|IFA_F_DADFAILED); 3298 ifp->flags &= ~(IFA_F_TENTATIVE|IFA_F_OPTIMISTIC|IFA_F_DADFAILED);
3234 spin_unlock(&ifp->lock); 3299 spin_unlock(&ifp->lock);
3235 write_unlock(&idev->lock); 3300 write_unlock_bh(&idev->lock);
3236 3301
3237 addrconf_dad_completed(ifp); 3302 addrconf_dad_completed(ifp);
3238 3303
@@ -3240,16 +3305,17 @@ static void addrconf_dad_timer(unsigned long data)
3240 } 3305 }
3241 3306
3242 ifp->dad_probes--; 3307 ifp->dad_probes--;
3243 addrconf_mod_dad_timer(ifp, 3308 addrconf_mod_dad_work(ifp,
3244 NEIGH_VAR(ifp->idev->nd_parms, RETRANS_TIME)); 3309 NEIGH_VAR(ifp->idev->nd_parms, RETRANS_TIME));
3245 spin_unlock(&ifp->lock); 3310 spin_unlock(&ifp->lock);
3246 write_unlock(&idev->lock); 3311 write_unlock_bh(&idev->lock);
3247 3312
3248 /* send a neighbour solicitation for our addr */ 3313 /* send a neighbour solicitation for our addr */
3249 addrconf_addr_solict_mult(&ifp->addr, &mcaddr); 3314 addrconf_addr_solict_mult(&ifp->addr, &mcaddr);
3250 ndisc_send_ns(ifp->idev->dev, NULL, &ifp->addr, &mcaddr, &in6addr_any); 3315 ndisc_send_ns(ifp->idev->dev, NULL, &ifp->addr, &mcaddr, &in6addr_any);
3251out: 3316out:
3252 in6_ifa_put(ifp); 3317 in6_ifa_put(ifp);
3318 rtnl_unlock();
3253} 3319}
3254 3320
3255/* ifp->idev must be at least read locked */ 3321/* ifp->idev must be at least read locked */
@@ -3276,7 +3342,7 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
3276 struct in6_addr lladdr; 3342 struct in6_addr lladdr;
3277 bool send_rs, send_mld; 3343 bool send_rs, send_mld;
3278 3344
3279 addrconf_del_dad_timer(ifp); 3345 addrconf_del_dad_work(ifp);
3280 3346
3281 /* 3347 /*
3282 * Configure the address for reception. Now it is valid. 3348 * Configure the address for reception. Now it is valid.
@@ -3517,23 +3583,23 @@ int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr)
3517 * Periodic address status verification 3583 * Periodic address status verification
3518 */ 3584 */
3519 3585
3520static void addrconf_verify(unsigned long foo) 3586static void addrconf_verify_rtnl(void)
3521{ 3587{
3522 unsigned long now, next, next_sec, next_sched; 3588 unsigned long now, next, next_sec, next_sched;
3523 struct inet6_ifaddr *ifp; 3589 struct inet6_ifaddr *ifp;
3524 int i; 3590 int i;
3525 3591
3592 ASSERT_RTNL();
3593
3526 rcu_read_lock_bh(); 3594 rcu_read_lock_bh();
3527 spin_lock(&addrconf_verify_lock);
3528 now = jiffies; 3595 now = jiffies;
3529 next = round_jiffies_up(now + ADDR_CHECK_FREQUENCY); 3596 next = round_jiffies_up(now + ADDR_CHECK_FREQUENCY);
3530 3597
3531 del_timer(&addr_chk_timer); 3598 cancel_delayed_work(&addr_chk_work);
3532 3599
3533 for (i = 0; i < IN6_ADDR_HSIZE; i++) { 3600 for (i = 0; i < IN6_ADDR_HSIZE; i++) {
3534restart: 3601restart:
3535 hlist_for_each_entry_rcu_bh(ifp, 3602 hlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[i], addr_lst) {
3536 &inet6_addr_lst[i], addr_lst) {
3537 unsigned long age; 3603 unsigned long age;
3538 3604
3539 /* When setting preferred_lft to a value not zero or 3605 /* When setting preferred_lft to a value not zero or
@@ -3628,13 +3694,22 @@ restart:
3628 3694
3629 ADBG(KERN_DEBUG "now = %lu, schedule = %lu, rounded schedule = %lu => %lu\n", 3695 ADBG(KERN_DEBUG "now = %lu, schedule = %lu, rounded schedule = %lu => %lu\n",
3630 now, next, next_sec, next_sched); 3696 now, next, next_sec, next_sched);
3631 3697 mod_delayed_work(addrconf_wq, &addr_chk_work, next_sched - now);
3632 addr_chk_timer.expires = next_sched;
3633 add_timer(&addr_chk_timer);
3634 spin_unlock(&addrconf_verify_lock);
3635 rcu_read_unlock_bh(); 3698 rcu_read_unlock_bh();
3636} 3699}
3637 3700
3701static void addrconf_verify_work(struct work_struct *w)
3702{
3703 rtnl_lock();
3704 addrconf_verify_rtnl();
3705 rtnl_unlock();
3706}
3707
3708static void addrconf_verify(void)
3709{
3710 mod_delayed_work(addrconf_wq, &addr_chk_work, 0);
3711}
3712
3638static struct in6_addr *extract_addr(struct nlattr *addr, struct nlattr *local, 3713static struct in6_addr *extract_addr(struct nlattr *addr, struct nlattr *local,
3639 struct in6_addr **peer_pfx) 3714 struct in6_addr **peer_pfx)
3640{ 3715{
@@ -3691,6 +3766,8 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
3691 bool was_managetempaddr; 3766 bool was_managetempaddr;
3692 bool had_prefixroute; 3767 bool had_prefixroute;
3693 3768
3769 ASSERT_RTNL();
3770
3694 if (!valid_lft || (prefered_lft > valid_lft)) 3771 if (!valid_lft || (prefered_lft > valid_lft))
3695 return -EINVAL; 3772 return -EINVAL;
3696 3773
@@ -3756,7 +3833,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
3756 !was_managetempaddr, jiffies); 3833 !was_managetempaddr, jiffies);
3757 } 3834 }
3758 3835
3759 addrconf_verify(0); 3836 addrconf_verify_rtnl();
3760 3837
3761 return 0; 3838 return 0;
3762} 3839}
@@ -4386,6 +4463,8 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
4386 bool update_rs = false; 4463 bool update_rs = false;
4387 struct in6_addr ll_addr; 4464 struct in6_addr ll_addr;
4388 4465
4466 ASSERT_RTNL();
4467
4389 if (token == NULL) 4468 if (token == NULL)
4390 return -EINVAL; 4469 return -EINVAL;
4391 if (ipv6_addr_any(token)) 4470 if (ipv6_addr_any(token))
@@ -4434,7 +4513,7 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
4434 } 4513 }
4435 4514
4436 write_unlock_bh(&idev->lock); 4515 write_unlock_bh(&idev->lock);
4437 addrconf_verify(0); 4516 addrconf_verify_rtnl();
4438 return 0; 4517 return 0;
4439} 4518}
4440 4519
@@ -4636,6 +4715,9 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
4636{ 4715{
4637 struct net *net = dev_net(ifp->idev->dev); 4716 struct net *net = dev_net(ifp->idev->dev);
4638 4717
4718 if (event)
4719 ASSERT_RTNL();
4720
4639 inet6_ifa_notify(event ? : RTM_NEWADDR, ifp); 4721 inet6_ifa_notify(event ? : RTM_NEWADDR, ifp);
4640 4722
4641 switch (event) { 4723 switch (event) {
@@ -5244,6 +5326,12 @@ int __init addrconf_init(void)
5244 if (err < 0) 5326 if (err < 0)
5245 goto out_addrlabel; 5327 goto out_addrlabel;
5246 5328
5329 addrconf_wq = create_workqueue("ipv6_addrconf");
5330 if (!addrconf_wq) {
5331 err = -ENOMEM;
5332 goto out_nowq;
5333 }
5334
5247 /* The addrconf netdev notifier requires that loopback_dev 5335 /* The addrconf netdev notifier requires that loopback_dev
5248 * has it's ipv6 private information allocated and setup 5336 * has it's ipv6 private information allocated and setup
5249 * before it can bring up and give link-local addresses 5337 * before it can bring up and give link-local addresses
@@ -5274,7 +5362,7 @@ int __init addrconf_init(void)
5274 5362
5275 register_netdevice_notifier(&ipv6_dev_notf); 5363 register_netdevice_notifier(&ipv6_dev_notf);
5276 5364
5277 addrconf_verify(0); 5365 addrconf_verify();
5278 5366
5279 rtnl_af_register(&inet6_ops); 5367 rtnl_af_register(&inet6_ops);
5280 5368
@@ -5302,6 +5390,8 @@ errout:
5302 rtnl_af_unregister(&inet6_ops); 5390 rtnl_af_unregister(&inet6_ops);
5303 unregister_netdevice_notifier(&ipv6_dev_notf); 5391 unregister_netdevice_notifier(&ipv6_dev_notf);
5304errlo: 5392errlo:
5393 destroy_workqueue(addrconf_wq);
5394out_nowq:
5305 unregister_pernet_subsys(&addrconf_ops); 5395 unregister_pernet_subsys(&addrconf_ops);
5306out_addrlabel: 5396out_addrlabel:
5307 ipv6_addr_label_cleanup(); 5397 ipv6_addr_label_cleanup();
@@ -5337,7 +5427,8 @@ void addrconf_cleanup(void)
5337 for (i = 0; i < IN6_ADDR_HSIZE; i++) 5427 for (i = 0; i < IN6_ADDR_HSIZE; i++)
5338 WARN_ON(!hlist_empty(&inet6_addr_lst[i])); 5428 WARN_ON(!hlist_empty(&inet6_addr_lst[i]));
5339 spin_unlock_bh(&addrconf_hash_lock); 5429 spin_unlock_bh(&addrconf_hash_lock);
5340 5430 cancel_delayed_work(&addr_chk_work);
5341 del_timer(&addr_chk_timer);
5342 rtnl_unlock(); 5431 rtnl_unlock();
5432
5433 destroy_workqueue(addrconf_wq);
5343} 5434}
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index f072fe803510..108120f216b1 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -354,13 +354,16 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
354 354
355 skb = nfnetlink_alloc_skb(net, size, queue->peer_portid, 355 skb = nfnetlink_alloc_skb(net, size, queue->peer_portid,
356 GFP_ATOMIC); 356 GFP_ATOMIC);
357 if (!skb) 357 if (!skb) {
358 skb_tx_error(entskb);
358 return NULL; 359 return NULL;
360 }
359 361
360 nlh = nlmsg_put(skb, 0, 0, 362 nlh = nlmsg_put(skb, 0, 0,
361 NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET, 363 NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET,
362 sizeof(struct nfgenmsg), 0); 364 sizeof(struct nfgenmsg), 0);
363 if (!nlh) { 365 if (!nlh) {
366 skb_tx_error(entskb);
364 kfree_skb(skb); 367 kfree_skb(skb);
365 return NULL; 368 return NULL;
366 } 369 }
@@ -488,13 +491,15 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
488 nla->nla_type = NFQA_PAYLOAD; 491 nla->nla_type = NFQA_PAYLOAD;
489 nla->nla_len = nla_attr_size(data_len); 492 nla->nla_len = nla_attr_size(data_len);
490 493
491 skb_zerocopy(skb, entskb, data_len, hlen); 494 if (skb_zerocopy(skb, entskb, data_len, hlen))
495 goto nla_put_failure;
492 } 496 }
493 497
494 nlh->nlmsg_len = skb->len; 498 nlh->nlmsg_len = skb->len;
495 return skb; 499 return skb;
496 500
497nla_put_failure: 501nla_put_failure:
502 skb_tx_error(entskb);
498 kfree_skb(skb); 503 kfree_skb(skb);
499 net_err_ratelimited("nf_queue: error creating packet message\n"); 504 net_err_ratelimited("nf_queue: error creating packet message\n");
500 return NULL; 505 return NULL;
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 48bbcd94631e..a3276e3c4feb 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -464,7 +464,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
464 } 464 }
465 nla->nla_len = nla_attr_size(skb->len); 465 nla->nla_len = nla_attr_size(skb->len);
466 466
467 skb_zerocopy(user_skb, skb, skb->len, hlen); 467 err = skb_zerocopy(user_skb, skb, skb->len, hlen);
468 if (err)
469 goto out;
468 470
469 /* Pad OVS_PACKET_ATTR_PACKET if linear copy was performed */ 471 /* Pad OVS_PACKET_ATTR_PACKET if linear copy was performed */
470 if (!(dp->user_features & OVS_DP_F_UNALIGNED)) { 472 if (!(dp->user_features & OVS_DP_F_UNALIGNED)) {
@@ -478,6 +480,8 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
478 480
479 err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid); 481 err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid);
480out: 482out:
483 if (err)
484 skb_tx_error(skb);
481 kfree_skb(nskb); 485 kfree_skb(nskb);
482 return err; 486 return err;
483} 487}
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index dda451f4429c..2998989e76db 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -103,30 +103,24 @@ static void stats_read(struct flow_stats *stats,
103void ovs_flow_stats_get(struct sw_flow *flow, struct ovs_flow_stats *ovs_stats, 103void ovs_flow_stats_get(struct sw_flow *flow, struct ovs_flow_stats *ovs_stats,
104 unsigned long *used, __be16 *tcp_flags) 104 unsigned long *used, __be16 *tcp_flags)
105{ 105{
106 int cpu, cur_cpu; 106 int cpu;
107 107
108 *used = 0; 108 *used = 0;
109 *tcp_flags = 0; 109 *tcp_flags = 0;
110 memset(ovs_stats, 0, sizeof(*ovs_stats)); 110 memset(ovs_stats, 0, sizeof(*ovs_stats));
111 111
112 local_bh_disable();
112 if (!flow->stats.is_percpu) { 113 if (!flow->stats.is_percpu) {
113 stats_read(flow->stats.stat, ovs_stats, used, tcp_flags); 114 stats_read(flow->stats.stat, ovs_stats, used, tcp_flags);
114 } else { 115 } else {
115 cur_cpu = get_cpu();
116 for_each_possible_cpu(cpu) { 116 for_each_possible_cpu(cpu) {
117 struct flow_stats *stats; 117 struct flow_stats *stats;
118 118
119 if (cpu == cur_cpu)
120 local_bh_disable();
121
122 stats = per_cpu_ptr(flow->stats.cpu_stats, cpu); 119 stats = per_cpu_ptr(flow->stats.cpu_stats, cpu);
123 stats_read(stats, ovs_stats, used, tcp_flags); 120 stats_read(stats, ovs_stats, used, tcp_flags);
124
125 if (cpu == cur_cpu)
126 local_bh_enable();
127 } 121 }
128 put_cpu();
129 } 122 }
123 local_bh_enable();
130} 124}
131 125
132static void stats_reset(struct flow_stats *stats) 126static void stats_reset(struct flow_stats *stats)
@@ -141,25 +135,17 @@ static void stats_reset(struct flow_stats *stats)
141 135
142void ovs_flow_stats_clear(struct sw_flow *flow) 136void ovs_flow_stats_clear(struct sw_flow *flow)
143{ 137{
144 int cpu, cur_cpu; 138 int cpu;
145 139
140 local_bh_disable();
146 if (!flow->stats.is_percpu) { 141 if (!flow->stats.is_percpu) {
147 stats_reset(flow->stats.stat); 142 stats_reset(flow->stats.stat);
148 } else { 143 } else {
149 cur_cpu = get_cpu();
150
151 for_each_possible_cpu(cpu) { 144 for_each_possible_cpu(cpu) {
152
153 if (cpu == cur_cpu)
154 local_bh_disable();
155
156 stats_reset(per_cpu_ptr(flow->stats.cpu_stats, cpu)); 145 stats_reset(per_cpu_ptr(flow->stats.cpu_stats, cpu));
157
158 if (cpu == cur_cpu)
159 local_bh_enable();
160 } 146 }
161 put_cpu();
162 } 147 }
148 local_bh_enable();
163} 149}
164 150
165static int check_header(struct sk_buff *skb, int len) 151static int check_header(struct sk_buff *skb, int len)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index ce6ec6c2f4de..94404f19f9de 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1787,8 +1787,11 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock,
1787 goto out; 1787 goto out;
1788 1788
1789 err = mutex_lock_interruptible(&u->readlock); 1789 err = mutex_lock_interruptible(&u->readlock);
1790 if (err) { 1790 if (unlikely(err)) {
1791 err = sock_intr_errno(sock_rcvtimeo(sk, noblock)); 1791 /* recvmsg() in non blocking mode is supposed to return -EAGAIN
1792 * sk_rcvtimeo is not honored by mutex_lock_interruptible()
1793 */
1794 err = noblock ? -EAGAIN : -ERESTARTSYS;
1792 goto out; 1795 goto out;
1793 } 1796 }
1794 1797
@@ -1913,6 +1916,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1913 struct unix_sock *u = unix_sk(sk); 1916 struct unix_sock *u = unix_sk(sk);
1914 DECLARE_SOCKADDR(struct sockaddr_un *, sunaddr, msg->msg_name); 1917 DECLARE_SOCKADDR(struct sockaddr_un *, sunaddr, msg->msg_name);
1915 int copied = 0; 1918 int copied = 0;
1919 int noblock = flags & MSG_DONTWAIT;
1916 int check_creds = 0; 1920 int check_creds = 0;
1917 int target; 1921 int target;
1918 int err = 0; 1922 int err = 0;
@@ -1928,7 +1932,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1928 goto out; 1932 goto out;
1929 1933
1930 target = sock_rcvlowat(sk, flags&MSG_WAITALL, size); 1934 target = sock_rcvlowat(sk, flags&MSG_WAITALL, size);
1931 timeo = sock_rcvtimeo(sk, flags&MSG_DONTWAIT); 1935 timeo = sock_rcvtimeo(sk, noblock);
1932 1936
1933 /* Lock the socket to prevent queue disordering 1937 /* Lock the socket to prevent queue disordering
1934 * while sleeps in memcpy_tomsg 1938 * while sleeps in memcpy_tomsg
@@ -1940,8 +1944,11 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1940 } 1944 }
1941 1945
1942 err = mutex_lock_interruptible(&u->readlock); 1946 err = mutex_lock_interruptible(&u->readlock);
1943 if (err) { 1947 if (unlikely(err)) {
1944 err = sock_intr_errno(timeo); 1948 /* recvmsg() in non blocking mode is supposed to return -EAGAIN
1949 * sk_rcvtimeo is not honored by mutex_lock_interruptible()
1950 */
1951 err = noblock ? -EAGAIN : -ERESTARTSYS;
1945 goto out; 1952 goto out;
1946 } 1953 }
1947 1954