History

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

Pull networking fixes from David Miller: 1) Fix NBMA tunnel mac header handling in GRE, from Timo Teräs. 2) Fix a NAPI race in the fec driver, from Nimrod Andy. 3) The new IFF_VNET_LE bit is outside the size of the flags member it is stored in (which is 16-bits), store the state locally in the drivers. From Michael S Tsirkin. 4) We are kicking the tires with the new wireless maintainership situation. Bluetooth fixes via Johan Hedberg, and mac80211 fixes from Johannes Berg. 5) Fix locking and leaks in geneve driver, from Jesse Gross. 6) Make netlink TX mmap code always copy, so we don't have to be potentially exposed to the user changing the underlying contents from underneath us. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (63 commits) be2net: Fix incorrect setting of tunnel offload flag in netdev features bnx2x: fix typos in "configure" xen-netback: support frontends without feature-rx-notify again MAINTAINERS: changes for wireless cxgb4: Fix decoding QSA module for ethtool get settings geneve: Fix races between socket add and release. geneve: Remove socket and offload handlers at destruction. netlink: Don't reorder loads/stores before marking mmap netlink frame as available netlink: Always copy on mmap TX. Bluetooth: Fix bug with filter in service discovery optimization mac80211: free management frame keys when removing station net: Disallow providing non zero VLAN ID for NIC drivers FDB add flow net/mlx4: Cache line CQE/EQE stride fixes net: fec: Fix NAPI race xen-netfront: use napi_complete() correctly to prevent Rx stalling ip_tunnel: Add missing validation of encap type to ip_tunnel_encap_setup() ip_tunnel: Add sanity checks to ip_tunnel_encap_add_ops() net: Allow FIXED_PHY to be modular. if_tun: drop broken IFF_VNET_LE macvtap: drop broken IFF_VNET_LE ...

Linus Torvalds committed 11 years ago

Commit 00c845d2 parents 28ee580 86c8fc458 files · +454 −297Browse files

Unified · Split

58 files
  1. Documentation/networking/fib_trie.txt +2 −2
  2. MAINTAINERS +8 −11
  3. drivers/bluetooth/ath3k.c +2 −0
  4. drivers/bluetooth/btusb.c +1 −0
  5. drivers/net/dsa/Kconfig +1 −1
  6. drivers/net/ethernet/broadcom/Kconfig +2 −2
  7. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +2 −2
  8. drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +2 −2
  9. drivers/net/ethernet/cadence/macb.c +9 −16
  10. drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +1 −1
  11. drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +1 −1
  12. drivers/net/ethernet/cirrus/cs89x0.c +14 −13
  13. drivers/net/ethernet/emulex/benet/be_main.c +2 −0
  14. drivers/net/ethernet/freescale/fec_main.c +7 −12
  15. drivers/net/ethernet/intel/i40e/i40e_main.c +5 −0
  16. drivers/net/ethernet/mellanox/mlx4/en_netdev.c +9 −2
  17. drivers/net/ethernet/mellanox/mlx4/fw.c +17 −13
  18. drivers/net/ethernet/mellanox/mlx4/fw.h +1 −0
  19. drivers/net/ethernet/mellanox/mlx4/main.c +34 −28
  20. drivers/net/ethernet/smsc/Kconfig +1 −1
  21. drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +5 −5
  22. drivers/net/macvtap.c +24 −6
  23. drivers/net/phy/Kconfig +2 −2
  24. drivers/net/phy/Makefile +1 −1
  25. drivers/net/phy/fixed_phy.c +0 −0
  26. drivers/net/tun.c +23 −3
  27. drivers/net/wireless/brcm80211/brcmsmac/main.c +1 −1
  28. drivers/net/wireless/hostap/hostap_cs.c +5 −10
  29. drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +2 −0
  30. drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +1 −1
  31. drivers/net/wireless/rtlwifi/rtl8821ae/dm.c +5 −6
  32. drivers/net/wireless/zd1211rw/zd_chip.c +3 −3
  33. drivers/net/xen-netback/common.h +3 −1
  34. drivers/net/xen-netback/interface.c +3 −1
  35. drivers/net/xen-netback/netback.c +14 −13
  36. drivers/net/xen-netback/xenbus.c +9 −3
  37. drivers/net/xen-netfront.c +3 −8
  38. include/linux/phy_fixed.h +1 −1
  39. include/uapi/linux/if_tun.h +2 −1
  40. net/bluetooth/hci_conn.c +1 −1
  41. net/bluetooth/hci_core.c +36 −24
  42. net/bluetooth/hci_event.c +20 −0
  43. net/bluetooth/l2cap_core.c +3 −2
  44. net/bluetooth/mgmt.c +69 −30
  45. net/bluetooth/smp.c +3 −2
  46. net/core/rtnetlink.c +5 −0
  47. net/ipv4/geneve.c +24 −6
  48. net/ipv4/ip_gre.c +5 −4
  49. net/ipv4/ip_tunnel.c +9 −0
  50. net/mac80211/chan.c +4 −0
  51. net/mac80211/key.c +1 −1
  52. net/mac80211/mlme.c +1 −0
  53. net/mac80211/rx.c +6 −5
  54. net/netlink/af_netlink.c +17 −37
  55. net/rds/message.c +2 −1
  56. net/wireless/chan.c +6 −3
  57. net/wireless/nl80211.c +1 −1
  58. net/wireless/reg.c +13 −7
Documentation/networking/fib_trie.txt+2−2
@@ -73,8 +73,8 @@ trie_leaf_remove() · 72 unmodified lines
7373
7474 trie_rebalance()
7575 The key function for the dynamic trie after any change in the trie
76− it is run to optimize and reorganize. Tt will walk the trie upwards
77− towards the root from a given tnode, doing a resize() at each step
76+ it is run to optimize and reorganize. It will walk the trie upwards
77+ towards the root from a given tnode, doing a resize() at each step
7878 to implement level compression.
7979
8080 resize()
MAINTAINERS+8−11
@@ -6610,19 +6610,8 @@ L: netdev@vger.kernel.org · 6609 unmodified lines
66106610 S: Maintained
66116611
66126612 NETWORKING [WIRELESS]
6613−M: "John W. Linville" <linville@tuxdriver.com>
66146613 L: linux-wireless@vger.kernel.org
66156614 Q: http://patchwork.kernel.org/project/linux-wireless/list/
6616−T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git
6617−S: Maintained
6618−F: net/mac80211/
6619−F: net/rfkill/
6620−F: net/wireless/
6621−F: include/net/ieee80211*
6622−F: include/linux/wireless.h
6623−F: include/uapi/linux/wireless.h
6624−F: include/net/iw_handler.h
6625−F: drivers/net/wireless/
66266615
66276616 NETWORKING DRIVERS
66286617 L: netdev@vger.kernel.org
@@ -6643,6 +6632,14 @@ F: include/linux/inetdevice.h · 14 unmodified lines
66436632 F: include/uapi/linux/if_*
66446633 F: include/uapi/linux/netdevice.h
66456634
6635+NETWORKING DRIVERS (WIRELESS)
6636+M: Kalle Valo <kvalo@codeaurora.org>
6637+L: linux-wireless@vger.kernel.org
6638+Q: http://patchwork.kernel.org/project/linux-wireless/list/
6639+T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git/
6640+S: Maintained
6641+F: drivers/net/wireless/
6642+
66466643 NETXEN (1/10) GbE SUPPORT
66476644 M: Manish Chopra <manish.chopra@qlogic.com>
66486645 M: Sony Chacko <sony.chacko@qlogic.com>
drivers/bluetooth/ath3k.c+2−0
@@ -87,6 +87,7 @@ static const struct usb_device_id ath3k_table[] = { · 86 unmodified lines
8787 { USB_DEVICE(0x04CA, 0x3007) },
8888 { USB_DEVICE(0x04CA, 0x3008) },
8989 { USB_DEVICE(0x04CA, 0x300b) },
90+ { USB_DEVICE(0x04CA, 0x3010) },
9091 { USB_DEVICE(0x0930, 0x0219) },
9192 { USB_DEVICE(0x0930, 0x0220) },
9293 { USB_DEVICE(0x0930, 0x0227) },
@@ -140,6 +141,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { · 47 unmodified lines
140141 { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 },
141142 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
142143 { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 },
144+ { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
143145 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
144146 { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
145147 { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c+1−0
@@ -167,6 +167,7 @@ static const struct usb_device_id blacklist_table[] = { · 166 unmodified lines
167167 { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 },
168168 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
169169 { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 },
170+ { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
170171 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
171172 { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
172173 { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 },
drivers/net/dsa/Kconfig+1−1
@@ -59,7 +59,7 @@ config NET_DSA_BCM_SF2 · 58 unmodified lines
5959 depends on HAS_IOMEM
6060 select NET_DSA
6161 select NET_DSA_TAG_BRCM
62− select FIXED_PHY if NET_DSA_BCM_SF2=y
62+ select FIXED_PHY
6363 select BCM7XXX_PHY
6464 select MDIO_BCM_UNIMAC
6565 ---help---
drivers/net/ethernet/broadcom/Kconfig+2−2
@@ -64,7 +64,7 @@ config BCMGENET · 63 unmodified lines
6464 tristate "Broadcom GENET internal MAC support"
6565 select MII
6666 select PHYLIB
67− select FIXED_PHY if BCMGENET=y
67+ select FIXED_PHY
6868 select BCM7XXX_PHY
6969 help
7070 This driver supports the built-in Ethernet MACs found in the
@@ -155,7 +155,7 @@ config SYSTEMPORT · 84 unmodified lines
155155 depends on OF
156156 select MII
157157 select PHYLIB
158− select FIXED_PHY if SYSTEMPORT=y
158+ select FIXED_PHY
159159 help
160160 This driver supports the built-in Ethernet MACs found in the
161161 Broadcom BCM7xxx Set Top Box family chipset using an internal
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+2−2
@@ -13256,7 +13256,7 @@ static int bnx2x_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) · 13255 unmodified lines
1325613256 return -EFAULT;
1325713257 }
1325813258
13259− DP(BNX2X_MSG_PTP, "Configrued val = %d, period = %d\n", best_val,
13259+ DP(BNX2X_MSG_PTP, "Configured val = %d, period = %d\n", best_val,
1326013260 best_period);
1326113261
1326213262 return 0;
@@ -14784,7 +14784,7 @@ static int bnx2x_hwtstamp_ioctl(struct bnx2x *bp, struct ifreq *ifr) · 1521 unmodified lines
1478414784 -EFAULT : 0;
1478514785 }
1478614786
14787−/* Configrues HW for PTP */
14787+/* Configures HW for PTP */
1478814788 static int bnx2x_configure_ptp(struct bnx2x *bp)
1478914789 {
1479014790 int rc, port = BP_PORT(bp);
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h+2−2
@@ -7549,7 +7549,7 @@ Theotherbitsarereservedandshouldbezero*/ · 7548 unmodified lines
75497549 #define IGU_REG_SISR_MDPC_WOMASK_UPPER 0x05a6
75507550
75517551 #define IGU_REG_RESERVED_UPPER 0x05ff
7552−/* Fields of IGU PF CONFIGRATION REGISTER */
7552+/* Fields of IGU PF CONFIGURATION REGISTER */
75537553 #define IGU_PF_CONF_FUNC_EN (0x1<<0) /* function enable */
75547554 #define IGU_PF_CONF_MSI_MSIX_EN (0x1<<1) /* MSI/MSIX enable */
75557555 #define IGU_PF_CONF_INT_LINE_EN (0x1<<2) /* INT enable */
@@ -7557,7 +7557,7 @@ Theotherbitsarereservedandshouldbezero*/ · 1 unmodified line
75577557 #define IGU_PF_CONF_SINGLE_ISR_EN (0x1<<4) /* single ISR mode enable */
75587558 #define IGU_PF_CONF_SIMD_MODE (0x1<<5) /* simd all ones mode */
75597559
7560−/* Fields of IGU VF CONFIGRATION REGISTER */
7560+/* Fields of IGU VF CONFIGURATION REGISTER */
75617561 #define IGU_VF_CONF_FUNC_EN (0x1<<0) /* function enable */
75627562 #define IGU_VF_CONF_MSI_MSIX_EN (0x1<<1) /* MSI/MSIX enable */
75637563 #define IGU_VF_CONF_PARENT_MASK (0x3<<2) /* Parent PF */
drivers/net/ethernet/cadence/macb.c+9−16
@@ -2160,7 +2160,7 @@ static int __init macb_probe(struct platform_device *pdev) · 2159 unmodified lines
21602160 int err = -ENXIO;
21612161 const char *mac;
21622162 void __iomem *mem;
2163− unsigned int hw_q, queue_mask, q, num_queues, q_irq = 0;
2163+ unsigned int hw_q, queue_mask, q, num_queues;
21642164 struct clk *pclk, *hclk, *tx_clk;
21652165
21662166 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -2235,11 +2235,11 @@ static int __init macb_probe(struct platform_device *pdev) · 68 unmodified lines
22352235 * register mapping but we don't want to test the queue index then
22362236 * compute the corresponding register offset at run time.
22372237 */
2238− for (hw_q = 0; hw_q < MACB_MAX_QUEUES; ++hw_q) {
2238+ for (hw_q = 0, q = 0; hw_q < MACB_MAX_QUEUES; ++hw_q) {
22392239 if (!(queue_mask & (1 << hw_q)))
22402240 continue;
22412241
2242− queue = &bp->queues[q_irq];
2242+ queue = &bp->queues[q];
22432243 queue->bp = bp;
22442244 if (hw_q) {
22452245 queue->ISR = GEM_ISR(hw_q - 1);
@@ -2261,18 +2261,18 @@ static int __init macb_probe(struct platform_device *pdev) · 15 unmodified lines
22612261 * must remove the optional gaps that could exist in the
22622262 * hardware queue mask.
22632263 */
2264− queue->irq = platform_get_irq(pdev, q_irq);
2264+ queue->irq = platform_get_irq(pdev, q);
22652265 err = devm_request_irq(&pdev->dev, queue->irq, macb_interrupt,
22662266 0, dev->name, queue);
22672267 if (err) {
22682268 dev_err(&pdev->dev,
22692269 "Unable to request IRQ %d (error %d)\n",
22702270 queue->irq, err);
2271− goto err_out_free_irq;
2271+ goto err_out_free_netdev;
22722272 }
22732273
22742274 INIT_WORK(&queue->tx_error_task, macb_tx_error_task);
2275− q_irq++;
2275+ q++;
22762276 }
22772277 dev->irq = bp->queues[0].irq;
22782278
@@ -2350,7 +2350,7 @@ static int __init macb_probe(struct platform_device *pdev) · 71 unmodified lines
23502350 err = register_netdev(dev);
23512351 if (err) {
23522352 dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
2353− goto err_out_free_irq;
2353+ goto err_out_free_netdev;
23542354 }
23552355
23562356 err = macb_mii_init(bp);
@@ -2373,9 +2373,7 @@ static int __init macb_probe(struct platform_device *pdev) · 16 unmodified lines
23732373
23742374 err_out_unregister_netdev:
23752375 unregister_netdev(dev);
2376−err_out_free_irq:
2377− for (q = 0, queue = bp->queues; q < q_irq; ++q, ++queue)
2378− devm_free_irq(&pdev->dev, queue->irq, queue);
2376+err_out_free_netdev:
23792377 free_netdev(dev);
23802378 err_out_disable_clocks:
23812379 if (!IS_ERR(tx_clk))
@@ -2392,8 +2390,6 @@ static int __exit macb_remove(struct platform_device *pdev) · 10 unmodified lines
23922390 {
23932391 struct net_device *dev;
23942392 struct macb *bp;
2395− struct macb_queue *queue;
2396− unsigned int q;
23972393
23982394 dev = platform_get_drvdata(pdev);
23992395
@@ -2405,14 +2401,11 @@ static int __exit macb_remove(struct platform_device *pdev) · 5 unmodified lines
24052401 kfree(bp->mii_bus->irq);
24062402 mdiobus_free(bp->mii_bus);
24072403 unregister_netdev(dev);
2408− queue = bp->queues;
2409− for (q = 0; q < bp->num_queues; ++q, ++queue)
2410− devm_free_irq(&pdev->dev, queue->irq, queue);
2411− free_netdev(dev);
24122404 if (!IS_ERR(bp->tx_clk))
24132405 clk_disable_unprepare(bp->tx_clk);
24142406 clk_disable_unprepare(bp->hclk);
24152407 clk_disable_unprepare(bp->pclk);
2408+ free_netdev(dev);
24162409 }
24172410
24182411 return 0;
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c+1−1
@@ -2376,7 +2376,7 @@ const char *t4_get_port_type_description(enum fw_port_type port_type) · 2375 unmodified lines
23762376 "KR/KX",
23772377 "KR/KX/KX4",
23782378 "R QSFP_10G",
2379− "",
2379+ "R QSA",
23802380 "R QSFP",
23812381 "R BP40_BA",
23822382 };
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h+1−1
@@ -2470,8 +2470,8 @@ enum fw_port_type { · 2469 unmodified lines
24702470 FW_PORT_TYPE_BP_AP,
24712471 FW_PORT_TYPE_BP4_AP,
24722472 FW_PORT_TYPE_QSFP_10G,
2473− FW_PORT_TYPE_QSFP,
24742473 FW_PORT_TYPE_QSA,
2474+ FW_PORT_TYPE_QSFP,
24752475 FW_PORT_TYPE_BP40_BA,
24762476
24772477 FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_M
drivers/net/ethernet/cirrus/cs89x0.c+14−13
@@ -60,6 +60,7 @@ · 59 unmodified lines
6060 #include <linux/interrupt.h>
6161 #include <linux/ioport.h>
6262 #include <linux/in.h>
63+#include <linux/jiffies.h>
6364 #include <linux/skbuff.h>
6465 #include <linux/spinlock.h>
6566 #include <linux/string.h>
@@ -238,13 +239,13 @@ writereg(struct net_device *dev, u16 regno, u16 value) · 172 unmodified lines
238239 static int __init
239240 wait_eeprom_ready(struct net_device *dev)
240241 {
241− int timeout = jiffies;
242+ unsigned long timeout = jiffies;
242243 /* check to see if the EEPROM is ready,
243244 * a timeout is used just in case EEPROM is ready when
244245 * SI_BUSY in the PP_SelfST is clear
245246 */
246247 while (readreg(dev, PP_SelfST) & SI_BUSY)
247− if (jiffies - timeout >= 40)
248+ if (time_after_eq(jiffies, timeout + 40))
248249 return -1;
249250 return 0;
250251 }
@@ -485,7 +486,7 @@ control_dc_dc(struct net_device *dev, int on_not_off) · 234 unmodified lines
485486 {
486487 struct net_local *lp = netdev_priv(dev);
487488 unsigned int selfcontrol;
488− int timenow = jiffies;
489+ unsigned long timenow = jiffies;
489490 /* control the DC to DC convertor in the SelfControl register.
490491 * Note: This is hooked up to a general purpose pin, might not
491492 * always be a DC to DC convertor.
@@ -499,7 +500,7 @@ control_dc_dc(struct net_device *dev, int on_not_off) · 7 unmodified lines
499500 writereg(dev, PP_SelfCTL, selfcontrol);
500501
501502 /* Wait for the DC/DC converter to power up - 500ms */
502− while (jiffies - timenow < HZ)
503+ while (time_before(jiffies, timenow + HZ))
503504 ;
504505 }
505506
@@ -514,7 +515,7 @@ send_test_pkt(struct net_device *dev) · 8 unmodified lines
514515 0, 0, /* DSAP=0 & SSAP=0 fields */
515516 0xf3, 0 /* Control (Test Req + P bit set) */
516517 };
517− long timenow = jiffies;
518+ unsigned long timenow = jiffies;
518519
519520 writereg(dev, PP_LineCTL, readreg(dev, PP_LineCTL) | SERIAL_TX_ON);
520521
@@ -525,10 +526,10 @@ send_test_pkt(struct net_device *dev) · 4 unmodified lines
525526 iowrite16(ETH_ZLEN, lp->virt_addr + TX_LEN_PORT);
526527
527528 /* Test to see if the chip has allocated memory for the packet */
528− while (jiffies - timenow < 5)
529+ while (time_before(jiffies, timenow + 5))
529530 if (readreg(dev, PP_BusST) & READY_FOR_TX_NOW)
530531 break;
531− if (jiffies - timenow >= 5)
532+ if (time_after_eq(jiffies, timenow + 5))
532533 return 0; /* this shouldn't happen */
533534
534535 /* Write the contents of the packet */
@@ -536,7 +537,7 @@ send_test_pkt(struct net_device *dev) · 1 unmodified line
536537
537538 cs89_dbg(1, debug, "Sending test packet ");
538539 /* wait a couple of jiffies for packet to be received */
539− for (timenow = jiffies; jiffies - timenow < 3;)
540+ for (timenow = jiffies; time_before(jiffies, timenow + 3);)
540541 ;
541542 if ((readreg(dev, PP_TxEvent) & TX_SEND_OK_BITS) == TX_OK) {
542543 cs89_dbg(1, cont, "succeeded\n");
@@ -556,7 +557,7 @@ static int · 13 unmodified lines
556557 detect_tp(struct net_device *dev)
557558 {
558559 struct net_local *lp = netdev_priv(dev);
559− int timenow = jiffies;
560+ unsigned long timenow = jiffies;
560561 int fdx;
561562
562563 cs89_dbg(1, debug, "%s: Attempting TP\n", dev->name);
@@ -574,7 +575,7 @@ detect_tp(struct net_device *dev) · 11 unmodified lines
574575 /* Delay for the hardware to work out if the TP cable is present
575576 * - 150ms
576577 */
577− for (timenow = jiffies; jiffies - timenow < 15;)
578+ for (timenow = jiffies; time_before(jiffies, timenow + 15);)
578579 ;
579580 if ((readreg(dev, PP_LineST) & LINK_OK) == 0)
580581 return DETECTED_NONE;
@@ -618,7 +619,7 @@ detect_tp(struct net_device *dev) · 37 unmodified lines
618619 if ((lp->auto_neg_cnf & AUTO_NEG_BITS) == AUTO_NEG_ENABLE) {
619620 pr_info("%s: negotiating duplex...\n", dev->name);
620621 while (readreg(dev, PP_AutoNegST) & AUTO_NEG_BUSY) {
621− if (jiffies - timenow > 4000) {
622+ if (time_after(jiffies, timenow + 4000)) {
622623 pr_err("**** Full / half duplex auto-negotiation timed out ****\n");
623624 break;
624625 }
@@ -1271,7 +1272,7 @@ static void __init reset_chip(struct net_device *dev) · 646 unmodified lines
12711272 {
12721273 #if !defined(CONFIG_MACH_MX31ADS)
12731274 struct net_local *lp = netdev_priv(dev);
1274− int reset_start_time;
1275+ unsigned long reset_start_time;
12751276
12761277 writereg(dev, PP_SelfCTL, readreg(dev, PP_SelfCTL) | POWER_ON_RESET);
12771278
@@ -1294,7 +1295,7 @@ static void __init reset_chip(struct net_device *dev) · 16 unmodified lines
12941295 /* Wait until the chip is reset */
12951296 reset_start_time = jiffies;
12961297 while ((readreg(dev, PP_SelfST) & INIT_DONE) == 0 &&
1297− jiffies - reset_start_time < 2)
1298+ time_before(jiffies, reset_start_time + 2))
12981299 ;
12991300 #endif /* !CONFIG_MACH_MX31ADS */
13001301 }
drivers/net/ethernet/emulex/benet/be_main.c+2−0
@@ -3138,6 +3138,7 @@ static void be_disable_vxlan_offloads(struct be_adapter *adapter) · 3137 unmodified lines
31383138
31393139 netdev->hw_enc_features = 0;
31403140 netdev->hw_features &= ~(NETIF_F_GSO_UDP_TUNNEL);
3141+ netdev->features &= ~(NETIF_F_GSO_UDP_TUNNEL);
31413142 }
31423143 #endif
31433144
@@ -4429,6 +4430,7 @@ static void be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family, · 1285 unmodified lines
44294430 NETIF_F_TSO | NETIF_F_TSO6 |
44304431 NETIF_F_GSO_UDP_TUNNEL;
44314432 netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
4433+ netdev->features |= NETIF_F_GSO_UDP_TUNNEL;
44324434
44334435 dev_info(dev, "Enabled VxLAN offloads for UDP port %d\n",
44344436 be16_to_cpu(port));
drivers/net/ethernet/freescale/fec_main.c+7−12
@@ -1558,20 +1558,21 @@ fec_enet_interrupt(int irq, void *dev_id) · 1557 unmodified lines
15581558 {
15591559 struct net_device *ndev = dev_id;
15601560 struct fec_enet_private *fep = netdev_priv(ndev);
1561− const unsigned napi_mask = FEC_ENET_RXF | FEC_ENET_TXF;
15621561 uint int_events;
15631562 irqreturn_t ret = IRQ_NONE;
15641563
15651564 int_events = readl(fep->hwp + FEC_IEVENT);
1566− writel(int_events & ~napi_mask, fep->hwp + FEC_IEVENT);
1565+ writel(int_events, fep->hwp + FEC_IEVENT);
15671566 fec_enet_collect_events(fep, int_events);
15681567
1569− if (int_events & napi_mask) {
1568+ if (fep->work_tx || fep->work_rx) {
15701569 ret = IRQ_HANDLED;
15711570
1572− /* Disable the NAPI interrupts */
1573− writel(FEC_ENET_MII, fep->hwp + FEC_IMASK);
1574− napi_schedule(&fep->napi);
1571+ if (napi_schedule_prep(&fep->napi)) {
1572+ /* Disable the NAPI interrupts */
1573+ writel(FEC_ENET_MII, fep->hwp + FEC_IMASK);
1574+ __napi_schedule(&fep->napi);
1575+ }
15751576 }
15761577
15771578 if (int_events & FEC_ENET_MII) {
@@ -1591,12 +1592,6 @@ static int fec_enet_rx_napi(struct napi_struct *napi, int budget) · 13 unmodified lines
15911592 struct fec_enet_private *fep = netdev_priv(ndev);
15921593 int pkts;
15931594
1594− /*
1595− * Clear any pending transmit or receive interrupts before
1596− * processing the rings to avoid racing with the hardware.
1597− */
1598− writel(FEC_ENET_RXF | FEC_ENET_TXF, fep->hwp + FEC_IEVENT);
1599−
16001595 pkts = fec_enet_rx(ndev, budget);
16011596
16021597 fec_enet_tx(ndev);
drivers/net/ethernet/intel/i40e/i40e_main.c+5−0
@@ -7549,6 +7549,11 @@ static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], · 7548 unmodified lines
75497549 if (!(pf->flags & I40E_FLAG_SRIOV_ENABLED))
75507550 return -EOPNOTSUPP;
75517551
7552+ if (vid) {
7553+ pr_info("%s: vlans aren't supported yet for dev_uc|mc_add()\n", dev->name);
7554+ return -EINVAL;
7555+ }
7556+
75527557 /* Hardware does not support aging addresses so if a
75537558 * ndm_state is given only allow permanent addresses
75547559 */
drivers/net/ethernet/mellanox/mlx4/en_netdev.c+9−2
@@ -1569,8 +1569,15 @@ int mlx4_en_start_port(struct net_device *dev) · 1568 unmodified lines
15691569 mlx4_en_free_affinity_hint(priv, i);
15701570 goto cq_err;
15711571 }
1572− for (j = 0; j < cq->size; j++)
1573− cq->buf[j].owner_sr_opcode = MLX4_CQE_OWNER_MASK;
1572+
1573+ for (j = 0; j < cq->size; j++) {
1574+ struct mlx4_cqe *cqe = NULL;
1575+
1576+ cqe = mlx4_en_get_cqe(cq->buf, j, priv->cqe_size) +
1577+ priv->cqe_factor;
1578+ cqe->owner_sr_opcode = MLX4_CQE_OWNER_MASK;
1579+ }
1580+
15741581 err = mlx4_en_set_cq_moder(priv, cq);
15751582 if (err) {
15761583 en_err(priv, "Failed setting cq moderation parameters\n");
drivers/net/ethernet/mellanox/mlx4/fw.c+17−13
@@ -787,11 +787,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) · 786 unmodified lines
787787 if ((1 << (field & 0x3f)) > (PAGE_SIZE / dev_cap->bf_reg_size))
788788 field = 3;
789789 dev_cap->bf_regs_per_page = 1 << (field & 0x3f);
790− mlx4_dbg(dev, "BlueFlame available (reg size %d, regs/page %d)\n",
791− dev_cap->bf_reg_size, dev_cap->bf_regs_per_page);
792790 } else {
793791 dev_cap->bf_reg_size = 0;
794− mlx4_dbg(dev, "BlueFlame not available\n");
795792 }
796793
797794 MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_SG_SQ_OFFSET);
@@ -902,9 +899,6 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) · 104 unmodified lines
902899 goto out;
903900 }
904901
905− mlx4_dbg(dev, "Base MM extensions: flags %08x, rsvd L_Key %08x\n",
906− dev_cap->bmme_flags, dev_cap->reserved_lkey);
907−
908902 /*
909903 * Each UAR has 4 EQ doorbells; so if a UAR is reserved, then
910904 * we can't use any EQs whose doorbell falls on that page,
@@ -916,6 +910,21 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) · 5 unmodified lines
916910 else
917911 dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_SYS_EQS;
918912
913+out:
914+ mlx4_free_cmd_mailbox(dev, mailbox);
915+ return err;
916+}
917+
918+void mlx4_dev_cap_dump(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
919+{
920+ if (dev_cap->bf_reg_size > 0)
921+ mlx4_dbg(dev, "BlueFlame available (reg size %d, regs/page %d)\n",
922+ dev_cap->bf_reg_size, dev_cap->bf_regs_per_page);
923+ else
924+ mlx4_dbg(dev, "BlueFlame not available\n");
925+
926+ mlx4_dbg(dev, "Base MM extensions: flags %08x, rsvd L_Key %08x\n",
927+ dev_cap->bmme_flags, dev_cap->reserved_lkey);
919928 mlx4_dbg(dev, "Max ICM size %lld MB\n",
920929 (unsigned long long) dev_cap->max_icm_sz >> 20);
921930 mlx4_dbg(dev, "Max QPs: %d, reserved QPs: %d, entry size: %d\n",
@@ -949,13 +958,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) · 27 unmodified lines
949958 dev_cap->dmfs_high_rate_qpn_base);
950959 mlx4_dbg(dev, "DMFS high rate steer QPn range: %d\n",
951960 dev_cap->dmfs_high_rate_qpn_range);
952−
953961 dump_dev_cap_flags(dev, dev_cap->flags);
954962 dump_dev_cap_flags2(dev, dev_cap->flags2);
955−
956−out:
957− mlx4_free_cmd_mailbox(dev, mailbox);
958− return err;
959963 }
960964
961965 int mlx4_QUERY_PORT(struct mlx4_dev *dev, int port, struct mlx4_port_cap *port_cap)
@@ -1848,8 +1852,8 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev, · 886 unmodified lines
18481852 /* CX3 is capable of extending CQEs\EQEs to strides larger than 64B */
18491853 MLX4_GET(byte_field, outbox, INIT_HCA_EQE_CQE_STRIDE_OFFSET);
18501854 if (byte_field) {
1851− param->dev_cap_enabled |= MLX4_DEV_CAP_64B_EQE_ENABLED;
1852− param->dev_cap_enabled |= MLX4_DEV_CAP_64B_CQE_ENABLED;
1855+ param->dev_cap_enabled |= MLX4_DEV_CAP_EQE_STRIDE_ENABLED;
1856+ param->dev_cap_enabled |= MLX4_DEV_CAP_CQE_STRIDE_ENABLED;
18531857 param->cqe_size = 1 << ((byte_field &
18541858 MLX4_CQE_SIZE_MASK_STRIDE) + 5);
18551859 param->eqe_size = 1 << (((byte_field &
drivers/net/ethernet/mellanox/mlx4/fw.h+1−0
@@ -224,6 +224,7 @@ struct mlx4_set_ib_param { · 223 unmodified lines
224224 u32 cap_mask;
225225 };
226226
227+void mlx4_dev_cap_dump(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap);
227228 int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap);
228229 int mlx4_QUERY_PORT(struct mlx4_dev *dev, int port, struct mlx4_port_cap *port_cap);
229230 int mlx4_QUERY_FUNC_CAP(struct mlx4_dev *dev, u8 gen_or_port,
drivers/net/ethernet/mellanox/mlx4/main.c+34−28
@@ -305,6 +305,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) · 304 unmodified lines
305305 mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting\n");
306306 return err;
307307 }
308+ mlx4_dev_cap_dump(dev, dev_cap);
308309
309310 if (dev_cap->min_page_sz > PAGE_SIZE) {
310311 mlx4_err(dev, "HCA minimum page size of %d bigger than kernel PAGE_SIZE of %ld, aborting\n",
@@ -2488,41 +2489,42 @@ static u64 mlx4_enable_sriov(struct mlx4_dev *dev, struct pci_dev *pdev, · 2177 unmodified lines
24882489 u8 total_vfs, int existing_vfs)
24892490 {
24902491 u64 dev_flags = dev->flags;
2492+ int err = 0;
24912493
2492− dev->dev_vfs = kzalloc(
2493− total_vfs * sizeof(*dev->dev_vfs),
2494− GFP_KERNEL);
2494+ atomic_inc(&pf_loading);
2495+ if (dev->flags & MLX4_FLAG_SRIOV) {
2496+ if (existing_vfs != total_vfs) {
2497+ mlx4_err(dev, "SR-IOV was already enabled, but with num_vfs (%d) different than requested (%d)\n",
2498+ existing_vfs, total_vfs);
2499+ total_vfs = existing_vfs;
2500+ }
2501+ }
2502+
2503+ dev->dev_vfs = kzalloc(total_vfs * sizeof(*dev->dev_vfs), GFP_KERNEL);
24952504 if (NULL == dev->dev_vfs) {
24962505 mlx4_err(dev, "Failed to allocate memory for VFs\n");
24972506 goto disable_sriov;
2498− } else if (!(dev->flags & MLX4_FLAG_SRIOV)) {
2499− int err = 0;
2500−
2501− atomic_inc(&pf_loading);
2502− if (existing_vfs) {
2503− if (existing_vfs != total_vfs)
2504− mlx4_err(dev, "SR-IOV was already enabled, but with num_vfs (%d) different than requested (%d)\n",
2505− existing_vfs, total_vfs);
2506− } else {
2507− mlx4_warn(dev, "Enabling SR-IOV with %d VFs\n", total_vfs);
2508− err = pci_enable_sriov(pdev, total_vfs);
2509− }
2510− if (err) {
2511− mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d)\n",
2512− err);
2513− atomic_dec(&pf_loading);
2514− goto disable_sriov;
2515− } else {
2516− mlx4_warn(dev, "Running in master mode\n");
2517− dev_flags |= MLX4_FLAG_SRIOV |
2518− MLX4_FLAG_MASTER;
2519− dev_flags &= ~MLX4_FLAG_SLAVE;
2520− dev->num_vfs = total_vfs;
2521− }
2507+ }
2508+
2509+ if (!(dev->flags & MLX4_FLAG_SRIOV)) {
2510+ mlx4_warn(dev, "Enabling SR-IOV with %d VFs\n", total_vfs);
2511+ err = pci_enable_sriov(pdev, total_vfs);
2512+ }
2513+ if (err) {
2514+ mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d)\n",
2515+ err);
2516+ goto disable_sriov;
2517+ } else {
2518+ mlx4_warn(dev, "Running in master mode\n");
2519+ dev_flags |= MLX4_FLAG_SRIOV |
2520+ MLX4_FLAG_MASTER;
2521+ dev_flags &= ~MLX4_FLAG_SLAVE;
2522+ dev->num_vfs = total_vfs;
25222523 }
25232524 return dev_flags;
25242525
25252526 disable_sriov:
2527+ atomic_dec(&pf_loading);
25262528 dev->num_vfs = 0;
25272529 kfree(dev->dev_vfs);
25282530 return dev_flags & ~MLX4_FLAG_MASTER;
@@ -2606,8 +2608,10 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data, · 77 unmodified lines
26062608 }
26072609
26082610 if (total_vfs) {
2609− existing_vfs = pci_num_vf(pdev);
26102611 dev->flags = MLX4_FLAG_MASTER;
2612+ existing_vfs = pci_num_vf(pdev);
2613+ if (existing_vfs)
2614+ dev->flags |= MLX4_FLAG_SRIOV;
26112615 dev->num_vfs = total_vfs;
26122616 }
26132617 }
@@ -2643,6 +2647,7 @@ slave_start: · 29 unmodified lines
26432647 }
26442648
26452649 if (mlx4_is_master(dev)) {
2650+ /* when we hit the goto slave_start below, dev_cap already initialized */
26462651 if (!dev_cap) {
26472652 dev_cap = kzalloc(sizeof(*dev_cap), GFP_KERNEL);
26482653
@@ -2849,6 +2854,7 @@ slave_start: · 200 unmodified lines
28492854 if (mlx4_is_master(dev) && dev->num_vfs)
28502855 atomic_dec(&pf_loading);
28512856
2857+ kfree(dev_cap);
28522858 return 0;
28532859
28542860 err_port:
drivers/net/ethernet/smsc/Kconfig+1−1
@@ -39,7 +39,7 @@ config SMC91X · 38 unmodified lines
3939 select CRC32
4040 select MII
4141 depends on (ARM || M32R || SUPERH || MIPS || BLACKFIN || \
42− MN10300 || COLDFIRE || ARM64 || XTENSA || NIOS2)
42+ MN10300 || COLDFIRE || ARM64 || XTENSA || NIOS2) && (!OF || GPIOLIB)
4343 ---help---
4444 This is a driver for SMC's 91x series of Ethernet chipsets,
4545 including the SMC91C94 and the SMC91C111. Say Y if you want it
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c+5−5
@@ -309,16 +309,16 @@ static int sti_dwmac_parse_data(struct sti_dwmac *dwmac, · 308 unmodified lines
309309
310310 if (IS_PHY_IF_MODE_GBIT(dwmac->interface)) {
311311 const char *rs;
312− dwmac->tx_retime_src = TX_RETIME_SRC_CLKGEN;
313312
314313 err = of_property_read_string(np, "st,tx-retime-src", &rs);
315− if (err < 0)
314+ if (err < 0) {
316315 dev_warn(dev, "Use internal clock source\n");
317−
318− if (!strcasecmp(rs, "clk_125"))
316+ dwmac->tx_retime_src = TX_RETIME_SRC_CLKGEN;
317+ } else if (!strcasecmp(rs, "clk_125")) {
319318 dwmac->tx_retime_src = TX_RETIME_SRC_CLK_125;
320− else if (!strcasecmp(rs, "txclk"))
319+ } else if (!strcasecmp(rs, "txclk")) {
321320 dwmac->tx_retime_src = TX_RETIME_SRC_TXCLK;
321+ }
322322
323323 dwmac->speed = SPEED_1000;
324324 }
drivers/net/macvtap.c+24−6
@@ -46,16 +46,18 @@ struct macvtap_queue { · 45 unmodified lines
4646 struct list_head next;
4747 };
4848
49−#define MACVTAP_FEATURES (IFF_VNET_HDR | IFF_VNET_LE | IFF_MULTI_QUEUE)
49+#define MACVTAP_FEATURES (IFF_VNET_HDR | IFF_MULTI_QUEUE)
50+
51+#define MACVTAP_VNET_LE 0x80000000
5052
5153 static inline u16 macvtap16_to_cpu(struct macvtap_queue *q, __virtio16 val)
5254 {
53− return __virtio16_to_cpu(q->flags & IFF_VNET_LE, val);
55+ return __virtio16_to_cpu(q->flags & MACVTAP_VNET_LE, val);
5456 }
5557
5658 static inline __virtio16 cpu_to_macvtap16(struct macvtap_queue *q, u16 val)
5759 {
58− return __cpu_to_virtio16(q->flags & IFF_VNET_LE, val);
60+ return __cpu_to_virtio16(q->flags & MACVTAP_VNET_LE, val);
5961 }
6062
6163 static struct proto macvtap_proto = {
@@ -999,7 +1001,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, · 937 unmodified lines
9991001 void __user *argp = (void __user *)arg;
10001002 struct ifreq __user *ifr = argp;
10011003 unsigned int __user *up = argp;
1002− unsigned int u;
1004+ unsigned short u;
10031005 int __user *sp = argp;
10041006 int s;
10051007 int ret;
@@ -1014,7 +1016,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, · 8 unmodified lines
10141016 if ((u & ~MACVTAP_FEATURES) != (IFF_NO_PI | IFF_TAP))
10151017 ret = -EINVAL;
10161018 else
1017− q->flags = u;
1019+ q->flags = (q->flags & ~MACVTAP_FEATURES) | u;
10181020
10191021 return ret;
10201022
@@ -1027,8 +1029,9 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, · 6 unmodified lines
10271029 }
10281030
10291031 ret = 0;
1032+ u = q->flags;
10301033 if (copy_to_user(&ifr->ifr_name, vlan->dev->name, IFNAMSIZ) ||
1031− put_user(q->flags, &ifr->ifr_flags))
1034+ put_user(u, &ifr->ifr_flags))
10321035 ret = -EFAULT;
10331036 macvtap_put_vlan(vlan);
10341037 rtnl_unlock();
@@ -1069,6 +1072,21 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, · 34 unmodified lines
10691072 q->vnet_hdr_sz = s;
10701073 return 0;
10711074
1075+ case TUNGETVNETLE:
1076+ s = !!(q->flags & MACVTAP_VNET_LE);
1077+ if (put_user(s, sp))
1078+ return -EFAULT;
1079+ return 0;
1080+
1081+ case TUNSETVNETLE:
1082+ if (get_user(s, sp))
1083+ return -EFAULT;
1084+ if (s)
1085+ q->flags |= MACVTAP_VNET_LE;
1086+ else
1087+ q->flags &= ~MACVTAP_VNET_LE;
1088+ return 0;
1089+
10721090 case TUNSETOFFLOAD:
10731091 /* let the user check for future flags */
10741092 if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 |
drivers/net/phy/Kconfig+2−2
@@ -119,8 +119,8 @@ config MICREL_PHY · 118 unmodified lines
119119 Supports the KSZ9021, VSC8201, KS8001 PHYs.
120120
121121 config FIXED_PHY
122− bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
123− depends on PHYLIB=y
122+ tristate "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
123+ depends on PHYLIB
124124 ---help---
125125 Adds the platform "fixed" MDIO Bus to cover the boards that use
126126 PHYs that are not connected to the real MDIO bus.
drivers/net/phy/Makefile+1−1
@@ -17,7 +17,7 @@ obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o · 16 unmodified lines
1717 obj-$(CONFIG_ICPLUS_PHY) += icplus.o
1818 obj-$(CONFIG_REALTEK_PHY) += realtek.o
1919 obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o
20−obj-$(CONFIG_FIXED_PHY) += fixed.o
20+obj-$(CONFIG_FIXED_PHY) += fixed_phy.o
2121 obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
2222 obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o
2323 obj-$(CONFIG_NATIONAL_PHY) += national.o
drivers/net/phy/fixed_phy.crenamed from drivers/net/phy/fixed.c+0−0

File renamed without changes.

drivers/net/tun.c+23−3
@@ -110,9 +110,11 @@ do { \ · 109 unmodified lines
110110 * overload it to mean fasync when stored there.
111111 */
112112 #define TUN_FASYNC IFF_ATTACH_QUEUE
113+/* High bits in flags field are unused. */
114+#define TUN_VNET_LE 0x80000000
113115
114116 #define TUN_FEATURES (IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR | \
115− IFF_VNET_LE | IFF_MULTI_QUEUE)
117+ IFF_MULTI_QUEUE)
116118 #define GOODCOPY_LEN 128
117119
118120 #define FLT_EXACT_COUNT 8
@@ -208,12 +210,12 @@ struct tun_struct { · 89 unmodified lines
208210
209211 static inline u16 tun16_to_cpu(struct tun_struct *tun, __virtio16 val)
210212 {
211− return __virtio16_to_cpu(tun->flags & IFF_VNET_LE, val);
213+ return __virtio16_to_cpu(tun->flags & TUN_VNET_LE, val);
212214 }
213215
214216 static inline __virtio16 cpu_to_tun16(struct tun_struct *tun, u16 val)
215217 {
216− return __cpu_to_virtio16(tun->flags & IFF_VNET_LE, val);
218+ return __cpu_to_virtio16(tun->flags & TUN_VNET_LE, val);
217219 }
218220
219221 static inline u32 tun_hashfn(u32 rxhash)
@@ -1843,6 +1845,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, · 1623 unmodified lines
18431845 int sndbuf;
18441846 int vnet_hdr_sz;
18451847 unsigned int ifindex;
1848+ int le;
18461849 int ret;
18471850
18481851 if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || _IOC_TYPE(cmd) == 0x89) {
@@ -2042,6 +2045,23 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, · 193 unmodified lines
20422045 tun->vnet_hdr_sz = vnet_hdr_sz;
20432046 break;
20442047
2048+ case TUNGETVNETLE:
2049+ le = !!(tun->flags & TUN_VNET_LE);
2050+ if (put_user(le, (int __user *)argp))
2051+ ret = -EFAULT;
2052+ break;
2053+
2054+ case TUNSETVNETLE:
2055+ if (get_user(le, (int __user *)argp)) {
2056+ ret = -EFAULT;
2057+ break;
2058+ }
2059+ if (le)
2060+ tun->flags |= TUN_VNET_LE;
2061+ else
2062+ tun->flags &= ~TUN_VNET_LE;
2063+ break;
2064+
20452065 case TUNATTACHFILTER:
20462066 /* Can be set only for TAPs */
20472067 ret = -EINVAL;
drivers/net/wireless/brcm80211/brcmsmac/main.c+1−1
@@ -316,7 +316,7 @@ static const u16 xmtfifo_sz[][NFIFO] = { · 315 unmodified lines
316316 static const char * const fifo_names[] = {
317317 "AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" };
318318 #else
319−static const char fifo_names[6][0];
319+static const char fifo_names[6][1];
320320 #endif
321321
322322 #ifdef DEBUG
drivers/net/wireless/hostap/hostap_cs.c+5−10
@@ -381,18 +381,15 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) · 380 unmodified lines
381381
382382 res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor);
383383 if (res != 0) {
384− printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
385− "(%d)\n", res);
384+ printk(KERN_DEBUG "%s failed 1 (%d)\n", __func__, res);
386385 return;
387386 }
388− printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n",
389− old_cor);
387+ printk(KERN_DEBUG "%s: original COR %02x\n", __func__, old_cor);
390388
391389 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
392390 old_cor | COR_SOFT_RESET);
393391 if (res != 0) {
394− printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
395− "(%d)\n", res);
392+ printk(KERN_DEBUG "%s failed 2 (%d)\n", __func__, res);
396393 return;
397394 }
398395
@@ -401,8 +398,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) · 2 unmodified lines
401398 /* Setup Genesis mode */
402399 res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr);
403400 if (res != 0) {
404− printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
405− "(%d)\n", res);
401+ printk(KERN_DEBUG "%s failed 3 (%d)\n", __func__, res);
406402 return;
407403 }
408404 mdelay(10);
@@ -410,8 +406,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) · 1 unmodified line
410406 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
411407 old_cor & ~COR_SOFT_RESET);
412408 if (res != 0) {
413− printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
414− "(%d)\n", res);
409+ printk(KERN_DEBUG "%s failed 4 (%d)\n", __func__, res);
415410 return;
416411 }
417412
drivers/net/wireless/rtlwifi/rtl8192ce/hw.c+2−0
@@ -955,6 +955,7 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw) · 954 unmodified lines
955955 local_save_flags(flags);
956956 local_irq_enable();
957957
958+ rtlhal->fw_ready = false;
958959 rtlpriv->intf_ops->disable_aspm(hw);
959960 rtstatus = _rtl92ce_init_mac(hw);
960961 if (!rtstatus) {
@@ -971,6 +972,7 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw) · 10 unmodified lines
971972 goto exit;
972973 }
973974
975+ rtlhal->fw_ready = true;
974976 rtlhal->last_hmeboxnum = 0;
975977 rtl92c_phy_mac_config(hw);
976978 /* because last function modify RCR, so we update
drivers/net/wireless/rtlwifi/rtl8192cu/hw.c+1−1
@@ -1592,7 +1592,7 @@ void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) · 1591 unmodified lines
15921592 }
15931593 }
15941594
1595−bool usb_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)
1595+static bool usb_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)
15961596 {
15971597 /* Currently nothing happens here.
15981598 * Traffic stops after some seconds in WPA2 802.11n mode.
drivers/net/wireless/rtlwifi/rtl8821ae/dm.c+5−6
@@ -2078,8 +2078,7 @@ void rtl8821ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw, · 2077 unmodified lines
20782078 if (rtldm->tx_rate != 0xFF)
20792079 tx_rate = rtl8821ae_hw_rate_to_mrate(hw, rtldm->tx_rate);
20802080
2081− RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
2082− "===>rtl8812ae_dm_txpwr_track_set_pwr\n");
2081+ RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "===>%s\n", __func__);
20832082
20842083 if (tx_rate != 0xFF) { /* Mimic Modify High Rate BBSwing Limit.*/
20852084 /*CCK*/
@@ -2128,7 +2127,7 @@ void rtl8821ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw, · 42 unmodified lines
21282127
21292128 if (method == BBSWING) {
21302129 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
2131− "===>rtl8812ae_dm_txpwr_track_set_pwr\n");
2130+ "===>%s\n", __func__);
21322131 if (rf_path == RF90_PATH_A) {
21332132 final_swing_idx[RF90_PATH_A] =
21342133 (rtldm->ofdm_index[RF90_PATH_A] >
@@ -2260,7 +2259,8 @@ void rtl8821ae_dm_txpower_tracking_callback_thermalmeter( · 125 unmodified lines
22602259 rtldm->txpower_trackinginit = true;
22612260
22622261 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
2263− "===>rtl8812ae_dm_txpower_tracking_callback_thermalmeter,\n pDM_Odm->BbSwingIdxCckBase: %d,pDM_Odm->BbSwingIdxOfdmBase[A]:%d, pDM_Odm->DefaultOfdmIndex: %d\n",
2262+ "===>%s,\n pDM_Odm->BbSwingIdxCckBase: %d,pDM_Odm->BbSwingIdxOfdmBase[A]:%d, pDM_Odm->DefaultOfdmIndex: %d\n",
2263+ __func__,
22642264 rtldm->swing_idx_cck_base,
22652265 rtldm->swing_idx_ofdm_base[RF90_PATH_A],
22662266 rtldm->default_ofdm_index);
@@ -2539,8 +2539,7 @@ void rtl8821ae_dm_txpower_tracking_callback_thermalmeter( · 272 unmodified lines
25392539 }
25402540 }
25412541
2542− RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
2543− "<===rtl8812ae_dm_txpower_tracking_callback_thermalmeter\n");
2542+ RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "<===%s\n", __func__);
25442543 }
25452544
25462545 void rtl8821ae_dm_check_txpower_tracking_thermalmeter(struct ieee80211_hw *hw)
drivers/net/wireless/zd1211rw/zd_chip.c+3−3
@@ -129,7 +129,7 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr · 128 unmodified lines
129129 r = zd_ioread16v_locked(chip, v16, a16, count16);
130130 if (r) {
131131 dev_dbg_f(zd_chip_dev(chip),
132− "error: zd_ioread16v_locked. Error number %d\n", r);
132+ "error: %s. Error number %d\n", __func__, r);
133133 return r;
134134 }
135135
@@ -256,8 +256,8 @@ int zd_iowrite32a_locked(struct zd_chip *chip, · 120 unmodified lines
256256 if (r) {
257257 zd_usb_iowrite16v_async_end(&chip->usb, 0);
258258 dev_dbg_f(zd_chip_dev(chip),
259− "error _zd_iowrite32v_locked."
260− " Error number %d\n", r);
259+ "error _%s. Error number %d\n", __func__,
260+ r);
261261 return r;
262262 }
263263 }
drivers/net/xen-netback/common.h+3−1
@@ -230,6 +230,8 @@ struct xenvif { · 229 unmodified lines
230230 */
231231 bool disabled;
232232 unsigned long status;
233+ unsigned long drain_timeout;
234+ unsigned long stall_timeout;
233235
234236 /* Queues */
235237 struct xenvif_queue *queues;
@@ -328,7 +330,7 @@ irqreturn_t xenvif_interrupt(int irq, void *dev_id); · 92 unmodified lines
328330 extern bool separate_tx_rx_irq;
329331
330332 extern unsigned int rx_drain_timeout_msecs;
331−extern unsigned int rx_drain_timeout_jiffies;
333+extern unsigned int rx_stall_timeout_msecs;
332334 extern unsigned int xenvif_max_queues;
333335
334336 #ifdef CONFIG_DEBUG_FS
drivers/net/xen-netback/interface.c+3−1
@@ -166,7 +166,7 @@ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) · 165 unmodified lines
166166 goto drop;
167167
168168 cb = XENVIF_RX_CB(skb);
169− cb->expires = jiffies + rx_drain_timeout_jiffies;
169+ cb->expires = jiffies + vif->drain_timeout;
170170
171171 xenvif_rx_queue_tail(queue, skb);
172172 xenvif_kick_thread(queue);
@@ -414,6 +414,8 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, · 241 unmodified lines
414414 vif->ip_csum = 1;
415415 vif->dev = dev;
416416 vif->disabled = false;
417+ vif->drain_timeout = msecs_to_jiffies(rx_drain_timeout_msecs);
418+ vif->stall_timeout = msecs_to_jiffies(rx_stall_timeout_msecs);
417419
418420 /* Start out with no queues. */
419421 vif->queues = NULL;
drivers/net/xen-netback/netback.c+14−13
@@ -60,14 +60,12 @@ module_param(separate_tx_rx_irq, bool, 0644); · 59 unmodified lines
6060 */
6161 unsigned int rx_drain_timeout_msecs = 10000;
6262 module_param(rx_drain_timeout_msecs, uint, 0444);
63−unsigned int rx_drain_timeout_jiffies;
6463
6564 /* The length of time before the frontend is considered unresponsive
6665 * because it isn't providing Rx slots.
6766 */
68−static unsigned int rx_stall_timeout_msecs = 60000;
67+unsigned int rx_stall_timeout_msecs = 60000;
6968 module_param(rx_stall_timeout_msecs, uint, 0444);
70−static unsigned int rx_stall_timeout_jiffies;
7169
7270 unsigned int xenvif_max_queues;
7371 module_param_named(max_queues, xenvif_max_queues, uint, 0644);
@@ -2020,7 +2018,7 @@ static bool xenvif_rx_queue_stalled(struct xenvif_queue *queue) · 1946 unmodified lines
20202018 return !queue->stalled
20212019 && prod - cons < XEN_NETBK_RX_SLOTS_MAX
20222020 && time_after(jiffies,
2023− queue->last_rx_time + rx_stall_timeout_jiffies);
2021+ queue->last_rx_time + queue->vif->stall_timeout);
20242022 }
20252023
20262024 static bool xenvif_rx_queue_ready(struct xenvif_queue *queue)
@@ -2038,8 +2036,9 @@ static bool xenvif_have_rx_work(struct xenvif_queue *queue) · 11 unmodified lines
20382036 {
20392037 return (!skb_queue_empty(&queue->rx_queue)
20402038 && xenvif_rx_ring_slots_available(queue, XEN_NETBK_RX_SLOTS_MAX))
2041− || xenvif_rx_queue_stalled(queue)
2042− || xenvif_rx_queue_ready(queue)
2039+ || (queue->vif->stall_timeout &&
2040+ (xenvif_rx_queue_stalled(queue)
2041+ || xenvif_rx_queue_ready(queue)))
20432042 || kthread_should_stop()
20442043 || queue->vif->disabled;
20452044 }
@@ -2092,6 +2091,9 @@ int xenvif_kthread_guest_rx(void *data) · 46 unmodified lines
20922091 struct xenvif_queue *queue = data;
20932092 struct xenvif *vif = queue->vif;
20942093
2094+ if (!vif->stall_timeout)
2095+ xenvif_queue_carrier_on(queue);
2096+
20952097 for (;;) {
20962098 xenvif_wait_for_rx_work(queue);
20972099
@@ -2118,10 +2120,12 @@ int xenvif_kthread_guest_rx(void *data) · 20 unmodified lines
21182120 * while it's probably not responsive, drop the
21192121 * carrier so packets are dropped earlier.
21202122 */
2121− if (xenvif_rx_queue_stalled(queue))
2122− xenvif_queue_carrier_off(queue);
2123− else if (xenvif_rx_queue_ready(queue))
2124− xenvif_queue_carrier_on(queue);
2123+ if (vif->stall_timeout) {
2124+ if (xenvif_rx_queue_stalled(queue))
2125+ xenvif_queue_carrier_off(queue);
2126+ else if (xenvif_rx_queue_ready(queue))
2127+ xenvif_queue_carrier_on(queue);
2128+ }
21252129
21262130 /* Queued packets may have foreign pages from other
21272131 * domains. These cannot be queued indefinitely as
@@ -2192,9 +2196,6 @@ static int __init netback_init(void) · 64 unmodified lines
21922196 if (rc)
21932197 goto failed_init;
21942198
2195− rx_drain_timeout_jiffies = msecs_to_jiffies(rx_drain_timeout_msecs);
2196− rx_stall_timeout_jiffies = msecs_to_jiffies(rx_stall_timeout_msecs);
2197−
21982199 #ifdef CONFIG_DEBUG_FS
21992200 xen_netback_dbg_root = debugfs_create_dir("xen-netback", NULL);
22002201 if (IS_ERR_OR_NULL(xen_netback_dbg_root))
drivers/net/xen-netback/xenbus.c+9−3
@@ -887,9 +887,15 @@ static int read_xenbus_vif_flags(struct backend_info *be) · 886 unmodified lines
887887 return -EOPNOTSUPP;
888888
889889 if (xenbus_scanf(XBT_NIL, dev->otherend,
890− "feature-rx-notify", "%d", &val) < 0 || val == 0) {
891− xenbus_dev_fatal(dev, -EINVAL, "feature-rx-notify is mandatory");
892− return -EINVAL;
890+ "feature-rx-notify", "%d", &val) < 0)
891+ val = 0;
892+ if (!val) {
893+ /* - Reduce drain timeout to poll more frequently for
894+ * Rx requests.
895+ * - Disable Rx stall detection.
896+ */
897+ be->vif->drain_timeout = msecs_to_jiffies(30);
898+ be->vif->stall_timeout = 0;
893899 }
894900
895901 if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg",
drivers/net/xen-netfront.c+3−8
@@ -977,7 +977,6 @@ static int xennet_poll(struct napi_struct *napi, int budget) · 976 unmodified lines
977977 struct sk_buff_head rxq;
978978 struct sk_buff_head errq;
979979 struct sk_buff_head tmpq;
980− unsigned long flags;
981980 int err;
982981
983982 spin_lock(&queue->rx_lock);
@@ -1050,15 +1049,11 @@ err: · 66 unmodified lines
10501049 if (work_done < budget) {
10511050 int more_to_do = 0;
10521051
1053− napi_gro_flush(napi, false);
1054−
1055− local_irq_save(flags);
1052+ napi_complete(napi);
10561053
10571054 RING_FINAL_CHECK_FOR_RESPONSES(&queue->rx, more_to_do);
1058− if (!more_to_do)
1059− __napi_complete(napi);
1060−
1061− local_irq_restore(flags);
1055+ if (more_to_do)
1056+ napi_schedule(napi);
10621057 }
10631058
10641059 spin_unlock(&queue->rx_lock);
include/linux/phy_fixed.h+1−1
@@ -11,7 +11,7 @@ struct fixed_phy_status { · 10 unmodified lines
1111
1212 struct device_node;
1313
14−#ifdef CONFIG_FIXED_PHY
14+#if IS_ENABLED(CONFIG_FIXED_PHY)
1515 extern int fixed_phy_add(unsigned int irq, int phy_id,
1616 struct fixed_phy_status *status);
1717 extern struct phy_device *fixed_phy_register(unsigned int irq,
include/uapi/linux/if_tun.h+2−1
@@ -48,6 +48,8 @@ · 47 unmodified lines
4848 #define TUNSETQUEUE _IOW('T', 217, int)
4949 #define TUNSETIFINDEX _IOW('T', 218, unsigned int)
5050 #define TUNGETFILTER _IOR('T', 219, struct sock_fprog)
51+#define TUNSETVNETLE _IOW('T', 220, int)
52+#define TUNGETVNETLE _IOR('T', 221, int)
5153
5254 /* TUNSETIFF ifr flags */
5355 #define IFF_TUN 0x0001
@@ -57,7 +59,6 @@ · 3 unmodified lines
5759 #define IFF_ONE_QUEUE 0x2000
5860 #define IFF_VNET_HDR 0x4000
5961 #define IFF_TUN_EXCL 0x8000
60−#define IFF_VNET_LE 0x10000
6162 #define IFF_MULTI_QUEUE 0x0100
6263 #define IFF_ATTACH_QUEUE 0x0200
6364 #define IFF_DETACH_QUEUE 0x0400
net/bluetooth/hci_conn.c+1−1
@@ -661,7 +661,7 @@ static void hci_req_add_le_create_conn(struct hci_request *req, · 660 unmodified lines
661661 memset(&cp, 0, sizeof(cp));
662662
663663 /* Update random address, but set require_privacy to false so
664− * that we never connect with an unresolvable address.
664+ * that we never connect with an non-resolvable address.
665665 */
666666 if (hci_update_random_address(req, false, &own_addr_type))
667667 return;
net/bluetooth/hci_core.c+36−24
@@ -1373,8 +1373,6 @@ static void hci_init1_req(struct hci_request *req, unsigned long opt) · 1372 unmodified lines
13731373
13741374 static void bredr_setup(struct hci_request *req)
13751375 {
1376− struct hci_dev *hdev = req->hdev;
1377−
13781376 __le16 param;
13791377 __u8 flt_type;
13801378
@@ -1403,14 +1401,6 @@ static void bredr_setup(struct hci_request *req) · 22 unmodified lines
14031401 /* Connection accept timeout ~20 secs */
14041402 param = cpu_to_le16(0x7d00);
14051403 hci_req_add(req, HCI_OP_WRITE_CA_TIMEOUT, 2, &param);
1406−
1407− /* AVM Berlin (31), aka "BlueFRITZ!", reports version 1.2,
1408− * but it does not support page scan related HCI commands.
1409− */
1410− if (hdev->manufacturer != 31 && hdev->hci_ver > BLUETOOTH_VER_1_1) {
1411− hci_req_add(req, HCI_OP_READ_PAGE_SCAN_ACTIVITY, 0, NULL);
1412− hci_req_add(req, HCI_OP_READ_PAGE_SCAN_TYPE, 0, NULL);
1413− }
14141404 }
14151405
14161406 static void le_setup(struct hci_request *req)
@@ -1718,6 +1708,16 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt) · 301 unmodified lines
17181708 if (hdev->commands[5] & 0x10)
17191709 hci_setup_link_policy(req);
17201710
1711+ if (hdev->commands[8] & 0x01)
1712+ hci_req_add(req, HCI_OP_READ_PAGE_SCAN_ACTIVITY, 0, NULL);
1713+
1714+ /* Some older Broadcom based Bluetooth 1.2 controllers do not
1715+ * support the Read Page Scan Type command. Check support for
1716+ * this command in the bit mask of supported commands.
1717+ */
1718+ if (hdev->commands[13] & 0x01)
1719+ hci_req_add(req, HCI_OP_READ_PAGE_SCAN_TYPE, 0, NULL);
1720+
17211721 if (lmp_le_capable(hdev)) {
17221722 u8 events[8];
17231723
@@ -2634,6 +2634,12 @@ static int hci_dev_do_close(struct hci_dev *hdev) · 910 unmodified lines
26342634 drain_workqueue(hdev->workqueue);
26352635
26362636 hci_dev_lock(hdev);
2637+
2638+ if (!test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) {
2639+ if (hdev->dev_type == HCI_BREDR)
2640+ mgmt_powered(hdev, 0);
2641+ }
2642+
26372643 hci_inquiry_cache_flush(hdev);
26382644 hci_pend_le_actions_clear(hdev);
26392645 hci_conn_hash_flush(hdev);
@@ -2681,14 +2687,6 @@ static int hci_dev_do_close(struct hci_dev *hdev) · 41 unmodified lines
26812687 hdev->flags &= BIT(HCI_RAW);
26822688 hdev->dev_flags &= ~HCI_PERSISTENT_MASK;
26832689
2684− if (!test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) {
2685− if (hdev->dev_type == HCI_BREDR) {
2686− hci_dev_lock(hdev);
2687− mgmt_powered(hdev, 0);
2688− hci_dev_unlock(hdev);
2689− }
2690− }
2691−
26922690 /* Controller radio is available but is currently powered down */
26932691 hdev->amp_status = AMP_STATUS_POWERED_DOWN;
26942692
@@ -3083,7 +3081,9 @@ static void hci_power_on(struct work_struct *work) · 388 unmodified lines
30833081
30843082 err = hci_dev_do_open(hdev);
30853083 if (err < 0) {
3084+ hci_dev_lock(hdev);
30863085 mgmt_set_powered_failed(hdev, err);
3086+ hci_dev_unlock(hdev);
30873087 return;
30883088 }
30893089
@@ -3959,17 +3959,29 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy, · 869 unmodified lines
39593959 }
39603960
39613961 /* In case of required privacy without resolvable private address,
3962− * use an unresolvable private address. This is useful for active
3962+ * use an non-resolvable private address. This is useful for active
39633963 * scanning and non-connectable advertising.
39643964 */
39653965 if (require_privacy) {
3966− bdaddr_t urpa;
3966+ bdaddr_t nrpa;
3967+
3968+ while (true) {
3969+ /* The non-resolvable private address is generated
3970+ * from random six bytes with the two most significant
3971+ * bits cleared.
3972+ */
3973+ get_random_bytes(&nrpa, 6);
3974+ nrpa.b[5] &= 0x3f;
39673975
3968− get_random_bytes(&urpa, 6);
3969− urpa.b[5] &= 0x3f; /* Clear two most significant bits */
3976+ /* The non-resolvable private address shall not be
3977+ * equal to the public address.
3978+ */
3979+ if (bacmp(&hdev->bdaddr, &nrpa))
3980+ break;
3981+ }
39703982
39713983 *own_addr_type = ADDR_LE_DEV_RANDOM;
3972− set_random_addr(req, &urpa);
3984+ set_random_addr(req, &nrpa);
39733985 return 0;
39743986 }
39753987
@@ -5625,7 +5637,7 @@ void hci_req_add_le_passive_scan(struct hci_request *req) · 1649 unmodified lines
56255637 u8 filter_policy;
56265638
56275639 /* Set require_privacy to false since no SCAN_REQ are send
5628− * during passive scanning. Not using an unresolvable address
5640+ * during passive scanning. Not using an non-resolvable address
56295641 * here is important so that peer devices using direct
56305642 * advertising with our address will be correctly reported
56315643 * by the controller.
net/bluetooth/hci_event.c+20−0
@@ -257,6 +257,8 @@ static void hci_cc_write_auth_enable(struct hci_dev *hdev, struct sk_buff *skb) · 256 unmodified lines
257257 if (!sent)
258258 return;
259259
260+ hci_dev_lock(hdev);
261+
260262 if (!status) {
261263 __u8 param = *((__u8 *) sent);
262264
@@ -268,6 +270,8 @@ static void hci_cc_write_auth_enable(struct hci_dev *hdev, struct sk_buff *skb) · 5 unmodified lines
268270
269271 if (test_bit(HCI_MGMT, &hdev->dev_flags))
270272 mgmt_auth_enable_complete(hdev, status);
273+
274+ hci_dev_unlock(hdev);
271275 }
272276
273277 static void hci_cc_write_encrypt_mode(struct hci_dev *hdev, struct sk_buff *skb)
@@ -443,6 +447,8 @@ static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) · 169 unmodified lines
443447 if (!sent)
444448 return;
445449
450+ hci_dev_lock(hdev);
451+
446452 if (!status) {
447453 if (sent->mode)
448454 hdev->features[1][0] |= LMP_HOST_SSP;
@@ -458,6 +464,8 @@ static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) · 9 unmodified lines
458464 else
459465 clear_bit(HCI_SSP_ENABLED, &hdev->dev_flags);
460466 }
467+
468+ hci_dev_unlock(hdev);
461469 }
462470
463471 static void hci_cc_write_sc_support(struct hci_dev *hdev, struct sk_buff *skb)
@@ -471,6 +479,8 @@ static void hci_cc_write_sc_support(struct hci_dev *hdev, struct sk_buff *skb) · 7 unmodified lines
471479 if (!sent)
472480 return;
473481
482+ hci_dev_lock(hdev);
483+
474484 if (!status) {
475485 if (sent->support)
476486 hdev->features[1][0] |= LMP_HOST_SC;
@@ -486,6 +496,8 @@ static void hci_cc_write_sc_support(struct hci_dev *hdev, struct sk_buff *skb) · 9 unmodified lines
486496 else
487497 clear_bit(HCI_SC_ENABLED, &hdev->dev_flags);
488498 }
499+
500+ hci_dev_unlock(hdev);
489501 }
490502
491503 static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb)
@@ -1135,6 +1147,8 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, · 643 unmodified lines
11351147 if (!cp)
11361148 return;
11371149
1150+ hci_dev_lock(hdev);
1151+
11381152 switch (cp->enable) {
11391153 case LE_SCAN_ENABLE:
11401154 set_bit(HCI_LE_SCAN, &hdev->dev_flags);
@@ -1184,6 +1198,8 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, · 43 unmodified lines
11841198 BT_ERR("Used reserved LE_Scan_Enable param %d", cp->enable);
11851199 break;
11861200 }
1201+
1202+ hci_dev_unlock(hdev);
11871203 }
11881204
11891205 static void hci_cc_le_read_white_list_size(struct hci_dev *hdev,
@@ -1278,6 +1294,8 @@ static void hci_cc_write_le_host_supported(struct hci_dev *hdev, · 88 unmodified lines
12781294 if (!sent)
12791295 return;
12801296
1297+ hci_dev_lock(hdev);
1298+
12811299 if (sent->le) {
12821300 hdev->features[1][0] |= LMP_HOST_LE;
12831301 set_bit(HCI_LE_ENABLED, &hdev->dev_flags);
@@ -1291,6 +1309,8 @@ static void hci_cc_write_le_host_supported(struct hci_dev *hdev, · 7 unmodified lines
12911309 hdev->features[1][0] |= LMP_HOST_LE_BREDR;
12921310 else
12931311 hdev->features[1][0] &= ~LMP_HOST_LE_BREDR;
1312+
1313+ hci_dev_unlock(hdev);
12941314 }
12951315
12961316 static void hci_cc_set_adv_param(struct hci_dev *hdev, struct sk_buff *skb)
net/bluetooth/l2cap_core.c+3−2
@@ -6966,8 +6966,9 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) · 6965 unmodified lines
69666966 test_bit(HCI_HS_ENABLED, &hcon->hdev->dev_flags))
69676967 conn->local_fixed_chan |= L2CAP_FC_A2MP;
69686968
6969− if (bredr_sc_enabled(hcon->hdev) &&
6970− test_bit(HCI_LE_ENABLED, &hcon->hdev->dev_flags))
6969+ if (test_bit(HCI_LE_ENABLED, &hcon->hdev->dev_flags) &&
6970+ (bredr_sc_enabled(hcon->hdev) ||
6971+ test_bit(HCI_FORCE_LESC, &hcon->hdev->dbg_flags)))
69716972 conn->local_fixed_chan |= L2CAP_FC_SMP_BREDR;
69726973
69736974 mutex_init(&conn->ident_lock);
net/bluetooth/mgmt.c+69−30
@@ -2199,12 +2199,14 @@ static void le_enable_complete(struct hci_dev *hdev, u8 status) · 2198 unmodified lines
21992199 {
22002200 struct cmd_lookup match = { NULL, hdev };
22012201
2202+ hci_dev_lock(hdev);
2203+
22022204 if (status) {
22032205 u8 mgmt_err = mgmt_status(status);
22042206
22052207 mgmt_pending_foreach(MGMT_OP_SET_LE, hdev, cmd_status_rsp,
22062208 &mgmt_err);
2207− return;
2209+ goto unlock;
22082210 }
22092211
22102212 mgmt_pending_foreach(MGMT_OP_SET_LE, hdev, settings_rsp, &match);
@@ -2222,17 +2224,16 @@ static void le_enable_complete(struct hci_dev *hdev, u8 status) · 11 unmodified lines
22222224 if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
22232225 struct hci_request req;
22242226
2225− hci_dev_lock(hdev);
2226−
22272227 hci_req_init(&req, hdev);
22282228 update_adv_data(&req);
22292229 update_scan_rsp_data(&req);
22302230 hci_req_run(&req, NULL);
22312231
22322232 hci_update_background_scan(hdev);
2233−
2234− hci_dev_unlock(hdev);
22352233 }
2234+
2235+unlock:
2236+ hci_dev_unlock(hdev);
22362237 }
22372238
22382239 static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
@@ -3114,14 +3115,13 @@ static void pairing_complete(struct pending_cmd *cmd, u8 status) · 875 unmodified lines
31143115 conn->disconn_cfm_cb = NULL;
31153116
31163117 hci_conn_drop(conn);
3117− hci_conn_put(conn);
3118−
3119− mgmt_pending_remove(cmd);
31203118
31213119 /* The device is paired so there is no need to remove
31223120 * its connection parameters anymore.
31233121 */
31243122 clear_bit(HCI_CONN_PARAM_REMOVAL_PEND, &conn->flags);
3123+
3124+ hci_conn_put(conn);
31253125 }
31263126
31273127 void mgmt_smp_complete(struct hci_conn *conn, bool complete)
@@ -3130,8 +3130,10 @@ void mgmt_smp_complete(struct hci_conn *conn, bool complete) · 2 unmodified lines
31303130 struct pending_cmd *cmd;
31313131
31323132 cmd = find_pairing(conn);
3133− if (cmd)
3133+ if (cmd) {
31343134 cmd->cmd_complete(cmd, status);
3135+ mgmt_pending_remove(cmd);
3136+ }
31353137 }
31363138
31373139 static void pairing_complete_cb(struct hci_conn *conn, u8 status)
@@ -3141,10 +3143,13 @@ static void pairing_complete_cb(struct hci_conn *conn, u8 status) · 3 unmodified lines
31413143 BT_DBG("status %u", status);
31423144
31433145 cmd = find_pairing(conn);
3144− if (!cmd)
3146+ if (!cmd) {
31453147 BT_DBG("Unable to find a pending command");
3146− else
3147− cmd->cmd_complete(cmd, mgmt_status(status));
3148+ return;
3149+ }
3150+
3151+ cmd->cmd_complete(cmd, mgmt_status(status));
3152+ mgmt_pending_remove(cmd);
31483153 }
31493154
31503155 static void le_pairing_complete_cb(struct hci_conn *conn, u8 status)
@@ -3157,10 +3162,13 @@ static void le_pairing_complete_cb(struct hci_conn *conn, u8 status) · 6 unmodified lines
31573162 return;
31583163
31593164 cmd = find_pairing(conn);
3160− if (!cmd)
3165+ if (!cmd) {
31613166 BT_DBG("Unable to find a pending command");
3162− else
3163− cmd->cmd_complete(cmd, mgmt_status(status));
3167+ return;
3168+ }
3169+
3170+ cmd->cmd_complete(cmd, mgmt_status(status));
3171+ mgmt_pending_remove(cmd);
31643172 }
31653173
31663174 static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
@@ -3274,8 +3282,10 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data, · 107 unmodified lines
32743282 cmd->user_data = hci_conn_get(conn);
32753283
32763284 if ((conn->state == BT_CONNECTED || conn->state == BT_CONFIG) &&
3277− hci_conn_security(conn, sec_level, auth_type, true))
3278− pairing_complete(cmd, 0);
3285+ hci_conn_security(conn, sec_level, auth_type, true)) {
3286+ cmd->cmd_complete(cmd, 0);
3287+ mgmt_pending_remove(cmd);
3288+ }
32793289
32803290 err = 0;
32813291
@@ -3317,7 +3327,8 @@ static int cancel_pair_device(struct sock *sk, struct hci_dev *hdev, void *data, · 35 unmodified lines
33173327 goto unlock;
33183328 }
33193329
3320− pairing_complete(cmd, MGMT_STATUS_CANCELLED);
3330+ cmd->cmd_complete(cmd, MGMT_STATUS_CANCELLED);
3331+ mgmt_pending_remove(cmd);
33213332
33223333 err = cmd_complete(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE, 0,
33233334 addr, sizeof(*addr));
@@ -3791,7 +3802,7 @@ static bool trigger_discovery(struct hci_request *req, u8 *status) · 467 unmodified lines
37913802
37923803 /* All active scans will be done with either a resolvable
37933804 * private address (when privacy feature has been enabled)
3794− * or unresolvable private address.
3805+ * or non-resolvable private address.
37953806 */
37963807 err = hci_update_random_address(req, true, &own_addr_type);
37973808 if (err < 0) {
@@ -4279,12 +4290,14 @@ static void set_advertising_complete(struct hci_dev *hdev, u8 status) · 481 unmodified lines
42794290 {
42804291 struct cmd_lookup match = { NULL, hdev };
42814292
4293+ hci_dev_lock(hdev);
4294+
42824295 if (status) {
42834296 u8 mgmt_err = mgmt_status(status);
42844297
42854298 mgmt_pending_foreach(MGMT_OP_SET_ADVERTISING, hdev,
42864299 cmd_status_rsp, &mgmt_err);
4287− return;
4300+ goto unlock;
42884301 }
42894302
42904303 if (test_bit(HCI_LE_ADV, &hdev->dev_flags))
@@ -4299,6 +4312,9 @@ static void set_advertising_complete(struct hci_dev *hdev, u8 status) · 8 unmodified lines
42994312
43004313 if (match.sk)
43014314 sock_put(match.sk);
4315+
4316+unlock:
4317+ hci_dev_unlock(hdev);
43024318 }
43034319
43044320 static int set_advertising(struct sock *sk, struct hci_dev *hdev, void *data,
@@ -6081,6 +6097,11 @@ static int powered_update_hci(struct hci_dev *hdev) · 1776 unmodified lines
60816097 hci_req_add(&req, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
60826098 }
60836099
6100+ if (bredr_sc_enabled(hdev) && !lmp_host_sc_capable(hdev)) {
6101+ u8 sc = 0x01;
6102+ hci_req_add(&req, HCI_OP_WRITE_SC_SUPPORT, sizeof(sc), &sc);
6103+ }
6104+
60846105 if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags) &&
60856106 lmp_bredr_capable(hdev)) {
60866107 struct hci_cp_write_le_host_supported cp;
@@ -6130,8 +6151,7 @@ static int powered_update_hci(struct hci_dev *hdev) · 43 unmodified lines
61306151 int mgmt_powered(struct hci_dev *hdev, u8 powered)
61316152 {
61326153 struct cmd_lookup match = { NULL, hdev };
6133− u8 status_not_powered = MGMT_STATUS_NOT_POWERED;
6134− u8 zero_cod[] = { 0, 0, 0 };
6154+ u8 status, zero_cod[] = { 0, 0, 0 };
61356155 int err;
61366156
61376157 if (!test_bit(HCI_MGMT, &hdev->dev_flags))
@@ -6147,7 +6167,20 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered) · 9 unmodified lines
61476167 }
61486168
61496169 mgmt_pending_foreach(MGMT_OP_SET_POWERED, hdev, settings_rsp, &match);
6150− mgmt_pending_foreach(0, hdev, cmd_complete_rsp, &status_not_powered);
6170+
6171+ /* If the power off is because of hdev unregistration let
6172+ * use the appropriate INVALID_INDEX status. Otherwise use
6173+ * NOT_POWERED. We cover both scenarios here since later in
6174+ * mgmt_index_removed() any hci_conn callbacks will have already
6175+ * been triggered, potentially causing misleading DISCONNECTED
6176+ * status responses.
6177+ */
6178+ if (test_bit(HCI_UNREGISTER, &hdev->dev_flags))
6179+ status = MGMT_STATUS_INVALID_INDEX;
6180+ else
6181+ status = MGMT_STATUS_NOT_POWERED;
6182+
6183+ mgmt_pending_foreach(0, hdev, cmd_complete_rsp, &status);
61516184
61526185 if (memcmp(hdev->dev_class, zero_cod, sizeof(zero_cod)) != 0)
61536186 mgmt_event(MGMT_EV_CLASS_OF_DEV_CHANGED, hdev,
@@ -6681,8 +6714,10 @@ void mgmt_auth_failed(struct hci_conn *conn, u8 hci_status) · 527 unmodified lines
66816714 mgmt_event(MGMT_EV_AUTH_FAILED, conn->hdev, &ev, sizeof(ev),
66826715 cmd ? cmd->sk : NULL);
66836716
6684− if (cmd)
6685− pairing_complete(cmd, status);
6717+ if (cmd) {
6718+ cmd->cmd_complete(cmd, status);
6719+ mgmt_pending_remove(cmd);
6720+ }
66866721 }
66876722
66886723 void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status)
@@ -7046,13 +7081,15 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, · 357 unmodified lines
70467081 * kept and checking possible scan response data
70477082 * will be skipped.
70487083 */
7049− if (hdev->discovery.uuid_count > 0) {
7084+ if (hdev->discovery.uuid_count > 0)
70507085 match = eir_has_uuids(eir, eir_len,
70517086 hdev->discovery.uuid_count,
70527087 hdev->discovery.uuids);
7053− if (!match)
7054− return;
7055− }
7088+ else
7089+ match = true;
7090+
7091+ if (!match && !scan_rsp_len)
7092+ return;
70567093
70577094 /* Copy EIR or advertising data into event */
70587095 memcpy(ev->eir, eir, eir_len);
@@ -7061,8 +7098,10 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, · 2 unmodified lines
70617098 * provided, results with empty EIR or advertising data
70627099 * should be dropped since they do not match any UUID.
70637100 */
7064− if (hdev->discovery.uuid_count > 0)
7101+ if (hdev->discovery.uuid_count > 0 && !scan_rsp_len)
70657102 return;
7103+
7104+ match = false;
70667105 }
70677106
70687107 if (dev_class && !eir_has_data_type(ev->eir, eir_len, EIR_CLASS_OF_DEV))
net/bluetooth/smp.c+3−2
@@ -1673,7 +1673,8 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) · 1672 unmodified lines
16731673 /* SMP over BR/EDR requires special treatment */
16741674 if (conn->hcon->type == ACL_LINK) {
16751675 /* We must have a BR/EDR SC link */
1676− if (!test_bit(HCI_CONN_AES_CCM, &conn->hcon->flags))
1676+ if (!test_bit(HCI_CONN_AES_CCM, &conn->hcon->flags) &&
1677+ !test_bit(HCI_FORCE_LESC, &hdev->dbg_flags))
16771678 return SMP_CROSS_TRANSP_NOT_ALLOWED;
16781679
16791680 set_bit(SMP_FLAG_SC, &smp->flags);
@@ -2927,7 +2928,7 @@ static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid) · 1247 unmodified lines
29272928 tfm_aes = crypto_alloc_blkcipher("ecb(aes)", 0, 0);
29282929 if (IS_ERR(tfm_aes)) {
29292930 BT_ERR("Unable to create crypto context");
2930− return ERR_PTR(PTR_ERR(tfm_aes));
2931+ return ERR_CAST(tfm_aes);
29312932 }
29322933
29332934 create_chan:
net/core/rtnetlink.c+5−0
@@ -2368,6 +2368,11 @@ int ndo_dflt_fdb_add(struct ndmsg *ndm, · 2367 unmodified lines
23682368 return err;
23692369 }
23702370
2371+ if (vid) {
2372+ pr_info("%s: vlans aren't supported yet for dev_uc|mc_add()\n", dev->name);
2373+ return err;
2374+ }
2375+
23712376 if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr))
23722377 err = dev_uc_add_excl(dev, addr);
23732378 else if (is_multicast_ether_addr(addr))
net/ipv4/geneve.c+24−6
@@ -159,6 +159,15 @@ static void geneve_notify_add_rx_port(struct geneve_sock *gs) · 158 unmodified lines
159159 }
160160 }
161161
162+static void geneve_notify_del_rx_port(struct geneve_sock *gs)
163+{
164+ struct sock *sk = gs->sock->sk;
165+ sa_family_t sa_family = sk->sk_family;
166+
167+ if (sa_family == AF_INET)
168+ udp_del_offload(&gs->udp_offloads);
169+}
170+
162171 /* Callback from net/ipv4/udp.c to receive packets */
163172 static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
164173 {
@@ -287,6 +296,7 @@ struct geneve_sock *geneve_sock_add(struct net *net, __be16 port, · 122 unmodified lines
287296 geneve_rcv_t *rcv, void *data,
288297 bool no_share, bool ipv6)
289298 {
299+ struct geneve_net *gn = net_generic(net, geneve_net_id);
290300 struct geneve_sock *gs;
291301
292302 gs = geneve_socket_create(net, port, rcv, data, ipv6);
@@ -296,15 +306,15 @@ struct geneve_sock *geneve_sock_add(struct net *net, __be16 port, · 3 unmodified lines
296306 if (no_share) /* Return error if sharing is not allowed. */
297307 return ERR_PTR(-EINVAL);
298308
309+ spin_lock(&gn->sock_lock);
299310 gs = geneve_find_sock(net, port);
300− if (gs) {
301− if (gs->rcv == rcv)
302− atomic_inc(&gs->refcnt);
303− else
311+ if (gs && ((gs->rcv != rcv) ||
312+ !atomic_add_unless(&gs->refcnt, 1, 0)))
304313 gs = ERR_PTR(-EBUSY);
305− } else {
314+ spin_unlock(&gn->sock_lock);
315+
316+ if (!gs)
306317 gs = ERR_PTR(-EINVAL);
307− }
308318
309319 return gs;
310320 }
@@ -312,9 +322,17 @@ EXPORT_SYMBOL_GPL(geneve_sock_add); · 1 unmodified line
312322
313323 void geneve_sock_release(struct geneve_sock *gs)
314324 {
325+ struct net *net = sock_net(gs->sock->sk);
326+ struct geneve_net *gn = net_generic(net, geneve_net_id);
327+
315328 if (!atomic_dec_and_test(&gs->refcnt))
316329 return;
317330
331+ spin_lock(&gn->sock_lock);
332+ hlist_del_rcu(&gs->hlist);
333+ geneve_notify_del_rx_port(gs);
334+ spin_unlock(&gn->sock_lock);
335+
318336 queue_work(geneve_wq, &gs->del_work);
319337 }
320338 EXPORT_SYMBOL_GPL(geneve_sock_release);
net/ipv4/ip_gre.c+5−4
@@ -252,10 +252,6 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, · 251 unmodified lines
252252 struct ip_tunnel *tunnel = netdev_priv(dev);
253253 const struct iphdr *tnl_params;
254254
255− skb = gre_handle_offloads(skb, !!(tunnel->parms.o_flags&TUNNEL_CSUM));
256− if (IS_ERR(skb))
257− goto out;
258−
259255 if (dev->header_ops) {
260256 /* Need space for new headers */
261257 if (skb_cow_head(skb, dev->needed_headroom -
@@ -268,6 +264,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, · 6 unmodified lines
268264 * to gre header.
269265 */
270266 skb_pull(skb, tunnel->hlen + sizeof(struct iphdr));
267+ skb_reset_mac_header(skb);
271268 } else {
272269 if (skb_cow_head(skb, dev->needed_headroom))
273270 goto free_skb;
@@ -275,6 +272,10 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, · 1 unmodified line
275272 tnl_params = &tunnel->parms.iph;
276273 }
277274
275+ skb = gre_handle_offloads(skb, !!(tunnel->parms.o_flags&TUNNEL_CSUM));
276+ if (IS_ERR(skb))
277+ goto out;
278+
278279 __gre_xmit(skb, dev, tnl_params, skb->protocol);
279280
280281 return NETDEV_TX_OK;
net/ipv4/ip_tunnel.c+9−0
@@ -514,6 +514,9 @@ const struct ip_tunnel_encap_ops __rcu * · 513 unmodified lines
514514 int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *ops,
515515 unsigned int num)
516516 {
517+ if (num >= MAX_IPTUN_ENCAP_OPS)
518+ return -ERANGE;
519+
517520 return !cmpxchg((const struct ip_tunnel_encap_ops **)
518521 &iptun_encaps[num],
519522 NULL, ops) ? 0 : -1;
@@ -525,6 +528,9 @@ int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *ops, · 5 unmodified lines
525528 {
526529 int ret;
527530
531+ if (num >= MAX_IPTUN_ENCAP_OPS)
532+ return -ERANGE;
533+
528534 ret = (cmpxchg((const struct ip_tunnel_encap_ops **)
529535 &iptun_encaps[num],
530536 ops, NULL) == ops) ? 0 : -1;
@@ -567,6 +573,9 @@ int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t, · 36 unmodified lines
567573 if (t->encap.type == TUNNEL_ENCAP_NONE)
568574 return 0;
569575
576+ if (t->encap.type >= MAX_IPTUN_ENCAP_OPS)
577+ return -EINVAL;
578+
570579 rcu_read_lock();
571580 ops = rcu_dereference(iptun_encaps[t->encap.type]);
572581 if (likely(ops && ops->build_header))
net/mac80211/chan.c+4−0
@@ -1011,6 +1011,10 @@ ieee80211_vif_use_reserved_reassign(struct ieee80211_sub_if_data *sdata) · 1010 unmodified lines
10111011
10121012 ieee80211_vif_update_chandef(sdata, &sdata->reserved_chandef);
10131013
1014+ ieee80211_recalc_smps_chanctx(local, new_ctx);
1015+ ieee80211_recalc_radar_chanctx(local, new_ctx);
1016+ ieee80211_recalc_chanctx_min_def(local, new_ctx);
1017+
10141018 if (changed)
10151019 ieee80211_bss_info_change_notify(sdata, changed);
10161020
net/mac80211/key.c+1−1
@@ -656,7 +656,7 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local, · 655 unmodified lines
656656 int i;
657657
658658 mutex_lock(&local->key_mtx);
659− for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
659+ for (i = 0; i < ARRAY_SIZE(sta->gtk); i++) {
660660 key = key_mtx_dereference(local, sta->gtk[i]);
661661 if (!key)
662662 continue;
net/mac80211/mlme.c+1−0
@@ -174,6 +174,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, · 173 unmodified lines
174174 if (!(ht_cap->cap_info &
175175 cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40))) {
176176 ret = IEEE80211_STA_DISABLE_40MHZ;
177+ vht_chandef = *chandef;
177178 goto out;
178179 }
179180
net/mac80211/rx.c+6−5
@@ -1761,14 +1761,14 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) · 1760 unmodified lines
17611761 sc = le16_to_cpu(hdr->seq_ctrl);
17621762 frag = sc & IEEE80211_SCTL_FRAG;
17631763
1764− if (likely(!ieee80211_has_morefrags(fc) && frag == 0))
1765− goto out;
1766−
17671764 if (is_multicast_ether_addr(hdr->addr1)) {
17681765 rx->local->dot11MulticastReceivedFrameCount++;
1769− goto out;
1766+ goto out_no_led;
17701767 }
17711768
1769+ if (likely(!ieee80211_has_morefrags(fc) && frag == 0))
1770+ goto out;
1771+
17721772 I802_DEBUG_INC(rx->local->rx_handlers_fragments);
17731773
17741774 if (skb_linearize(rx->skb))
@@ -1859,9 +1859,10 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) · 84 unmodified lines
18591859 status->rx_flags |= IEEE80211_RX_FRAGMENTED;
18601860
18611861 out:
1862+ ieee80211_led_rx(rx->local);
1863+ out_no_led:
18621864 if (rx->sta)
18631865 rx->sta->rx_packets++;
1864− ieee80211_led_rx(rx->local);
18651866 return RX_CONTINUE;
18661867 }
18671868
net/netlink/af_netlink.c+17−37
@@ -525,14 +525,14 @@ out: · 524 unmodified lines
525525 return err;
526526 }
527527
528−static void netlink_frame_flush_dcache(const struct nl_mmap_hdr *hdr)
528+static void netlink_frame_flush_dcache(const struct nl_mmap_hdr *hdr, unsigned int nm_len)
529529 {
530530 #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 1
531531 struct page *p_start, *p_end;
532532
533533 /* First page is flushed through netlink_{get,set}_status */
534534 p_start = pgvec_to_page(hdr + PAGE_SIZE);
535− p_end = pgvec_to_page((void *)hdr + NL_MMAP_HDRLEN + hdr->nm_len - 1);
535+ p_end = pgvec_to_page((void *)hdr + NL_MMAP_HDRLEN + nm_len - 1);
536536 while (p_start <= p_end) {
537537 flush_dcache_page(p_start);
538538 p_start++;
@@ -550,9 +550,9 @@ static enum nl_mmap_status netlink_get_status(const struct nl_mmap_hdr *hdr) · 11 unmodified lines
550550 static void netlink_set_status(struct nl_mmap_hdr *hdr,
551551 enum nl_mmap_status status)
552552 {
553+ smp_mb();
553554 hdr->nm_status = status;
554555 flush_dcache_page(pgvec_to_page(hdr));
555− smp_wmb();
556556 }
557557
558558 static struct nl_mmap_hdr *
@@ -714,24 +714,16 @@ static int netlink_mmap_sendmsg(struct sock *sk, struct msghdr *msg, · 155 unmodified lines
714714 struct nl_mmap_hdr *hdr;
715715 struct sk_buff *skb;
716716 unsigned int maxlen;
717− bool excl = true;
718717 int err = 0, len = 0;
719718
720− /* Netlink messages are validated by the receiver before processing.
721− * In order to avoid userspace changing the contents of the message
722− * after validation, the socket and the ring may only be used by a
723− * single process, otherwise we fall back to copying.
724− */
725− if (atomic_long_read(&sk->sk_socket->file->f_count) > 1 ||
726− atomic_read(&nlk->mapped) > 1)
727− excl = false;
728−
729719 mutex_lock(&nlk->pg_vec_lock);
730720
731721 ring = &nlk->tx_ring;
732722 maxlen = ring->frame_size - NL_MMAP_HDRLEN;
733723
734724 do {
725+ unsigned int nm_len;
726+
735727 hdr = netlink_current_frame(ring, NL_MMAP_STATUS_VALID);
736728 if (hdr == NULL) {
737729 if (!(msg->msg_flags & MSG_DONTWAIT) &&
@@ -739,35 +731,23 @@ static int netlink_mmap_sendmsg(struct sock *sk, struct msghdr *msg, · 1 unmodified line
739731 schedule();
740732 continue;
741733 }
742− if (hdr->nm_len > maxlen) {
734+
735+ nm_len = ACCESS_ONCE(hdr->nm_len);
736+ if (nm_len > maxlen) {
743737 err = -EINVAL;
744738 goto out;
745739 }
746740
747− netlink_frame_flush_dcache(hdr);
741+ netlink_frame_flush_dcache(hdr, nm_len);
748742
749− if (likely(dst_portid == 0 && dst_group == 0 && excl)) {
750− skb = alloc_skb_head(GFP_KERNEL);
751− if (skb == NULL) {
752− err = -ENOBUFS;
753− goto out;
754− }
755− sock_hold(sk);
756− netlink_ring_setup_skb(skb, sk, ring, hdr);
757− NETLINK_CB(skb).flags |= NETLINK_SKB_TX;
758− __skb_put(skb, hdr->nm_len);
759− netlink_set_status(hdr, NL_MMAP_STATUS_RESERVED);
760− atomic_inc(&ring->pending);
761− } else {
762− skb = alloc_skb(hdr->nm_len, GFP_KERNEL);
763− if (skb == NULL) {
764− err = -ENOBUFS;
765− goto out;
766− }
767− __skb_put(skb, hdr->nm_len);
768− memcpy(skb->data, (void *)hdr + NL_MMAP_HDRLEN, hdr->nm_len);
769− netlink_set_status(hdr, NL_MMAP_STATUS_UNUSED);
743+ skb = alloc_skb(nm_len, GFP_KERNEL);
744+ if (skb == NULL) {
745+ err = -ENOBUFS;
746+ goto out;
770747 }
748+ __skb_put(skb, nm_len);
749+ memcpy(skb->data, (void *)hdr + NL_MMAP_HDRLEN, nm_len);
750+ netlink_set_status(hdr, NL_MMAP_STATUS_UNUSED);
771751
772752 netlink_increment_head(ring);
773753
@@ -813,7 +793,7 @@ static void netlink_queue_mmaped_skb(struct sock *sk, struct sk_buff *skb) · 39 unmodified lines
813793 hdr->nm_pid = NETLINK_CB(skb).creds.pid;
814794 hdr->nm_uid = from_kuid(sk_user_ns(sk), NETLINK_CB(skb).creds.uid);
815795 hdr->nm_gid = from_kgid(sk_user_ns(sk), NETLINK_CB(skb).creds.gid);
816− netlink_frame_flush_dcache(hdr);
796+ netlink_frame_flush_dcache(hdr, hdr->nm_len);
817797 netlink_set_status(hdr, NL_MMAP_STATUS_VALID);
818798
819799 NETLINK_CB(skb).flags |= NETLINK_SKB_DELIVERED;
net/rds/message.c+2−1
@@ -325,7 +325,8 @@ int rds_message_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to) · 324 unmodified lines
325325 copied = 0;
326326
327327 while (iov_iter_count(to) && copied < len) {
328− to_copy = min(iov_iter_count(to), sg->length - vec_off);
328+ to_copy = min_t(unsigned long, iov_iter_count(to),
329+ sg->length - vec_off);
329330 to_copy = min_t(unsigned long, to_copy, len - copied);
330331
331332 rds_stats_add(s_copy_to_user, to_copy);
net/wireless/chan.c+6−3
@@ -603,7 +603,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, · 602 unmodified lines
603603 {
604604 struct ieee80211_sta_ht_cap *ht_cap;
605605 struct ieee80211_sta_vht_cap *vht_cap;
606− u32 width, control_freq;
606+ u32 width, control_freq, cap;
607607
608608 if (WARN_ON(!cfg80211_chandef_valid(chandef)))
609609 return false;
@@ -643,7 +643,8 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, · 33 unmodified lines
643643 return false;
644644 break;
645645 case NL80211_CHAN_WIDTH_80P80:
646− if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ))
646+ cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
647+ if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
647648 return false;
648649 case NL80211_CHAN_WIDTH_80:
649650 if (!vht_cap->vht_supported)
@@ -654,7 +655,9 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, · 4 unmodified lines
654655 case NL80211_CHAN_WIDTH_160:
655656 if (!vht_cap->vht_supported)
656657 return false;
657− if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ))
658+ cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
659+ if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ &&
660+ cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
658661 return false;
659662 prohibited_flags |= IEEE80211_CHAN_NO_160MHZ;
660663 width = 160;
net/wireless/nl80211.c+1−1
@@ -6002,7 +6002,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, · 6001 unmodified lines
60026002 }
60036003
60046004 /* there was no other matchset, so the RSSI one is alone */
6005− if (i == 0)
6005+ if (i == 0 && n_match_sets)
60066006 request->match_sets[0].rssi_thold = default_match_rssi;
60076007
60086008 request->min_rssi_thold = INT_MAX;
net/wireless/reg.c+13−7
@@ -1546,12 +1546,18 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) · 1545 unmodified lines
15461546 if (!wdev->beacon_interval)
15471547 goto out;
15481548
1549+ ret = cfg80211_reg_can_beacon(wiphy,
1550+ &wdev->chandef, wdev->iftype);
1551+ break;
1552+ case NL80211_IFTYPE_ADHOC:
1553+ if (!wdev->ssid_len)
1554+ goto out;
1555+
15491556 ret = cfg80211_reg_can_beacon(wiphy,
15501557 &wdev->chandef, wdev->iftype);
15511558 break;
15521559 case NL80211_IFTYPE_STATION:
15531560 case NL80211_IFTYPE_P2P_CLIENT:
1554− case NL80211_IFTYPE_ADHOC:
15551561 if (!wdev->current_bss ||
15561562 !wdev->current_bss->pub.channel)
15571563 goto out;
@@ -1907,7 +1913,7 @@ static enum reg_request_treatment · 349 unmodified lines
19071913 reg_process_hint_driver(struct wiphy *wiphy,
19081914 struct regulatory_request *driver_request)
19091915 {
1910− const struct ieee80211_regdomain *regd;
1916+ const struct ieee80211_regdomain *regd, *tmp;
19111917 enum reg_request_treatment treatment;
19121918
19131919 treatment = __reg_process_hint_driver(driver_request);
@@ -1927,7 +1933,10 @@ reg_process_hint_driver(struct wiphy *wiphy, · 13 unmodified lines
19271933 reg_free_request(driver_request);
19281934 return REG_REQ_IGNORE;
19291935 }
1936+
1937+ tmp = get_wiphy_regdom(wiphy);
19301938 rcu_assign_pointer(wiphy->regd, regd);
1939+ rcu_free_regdom(tmp);
19311940 }
19321941
19331942
@@ -1986,11 +1995,8 @@ __reg_process_hint_country_ie(struct wiphy *wiphy, · 52 unmodified lines
19861995 return REG_REQ_IGNORE;
19871996 return REG_REQ_ALREADY_SET;
19881997 }
1989− /*
1990− * Two consecutive Country IE hints on the same wiphy.
1991− * This should be picked up early by the driver/stack
1992− */
1993− if (WARN_ON(regdom_changes(country_ie_request->alpha2)))
1998+
1999+ if (regdom_changes(country_ie_request->alpha2))
19942000 return REG_REQ_OK;
19952001 return REG_REQ_ALREADY_SET;
19962002 }