1. 10 Mar, 2021 5 commits
  2. 09 Mar, 2021 1 commit
    • Xie He's avatar
      net: lapbether: Remove netif_start_queue / netif_stop_queue · f7d9d485
      Xie He authored
      For the devices in this driver, the default qdisc is "noqueue",
      because their "tx_queue_len" is 0.
      
      In function "__dev_queue_xmit" in "net/core/dev.c", devices with the
      "noqueue" qdisc are specially handled. Packets are transmitted without
      being queued after a "dev->flags & IFF_UP" check. However, it's possible
      that even if this check succeeds, "ops->ndo_stop" may still have already
      been called. This is because in "__dev_close_many", "ops->ndo_stop" is
      called before clearing the "IFF_UP" flag.
      
      If we call "netif_stop_queue" in "ops->ndo_stop", then it's possible in
      "__dev_queue_xmit", it sees the "IFF_UP" flag is present, and then it
      checks "netif_xmit_stopped" and finds that the queue is already stopped.
      In this case, it will complain that:
      "Virtual device ... asks to queue packet!"
      
      To prevent "__dev_queue_xmit" from generating this complaint, we should
      not call "netif_stop_queue" in "ops->ndo_stop".
      
      We also don't need to call "netif_start_queue" in "ops->ndo_open",
      because after a netdev is allocated and registered, the
      "__QUEUE_STATE_DRV_XOFF" flag is initially not set, so there is no need
      to call "netif_start_queue" to clear it.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarXie He <xie.he.0141@gmail.com>
      Acked-by: default avatarMartin Schiller <ms@dev.tdt.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f7d9d485
  3. 08 Mar, 2021 18 commits
  4. 07 Mar, 2021 1 commit
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf · 9270bbe2
      David S. Miller authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      The following patchset contains Netfilter fixes for net:
      
      1) Fix incorrect enum type definition in nfnetlink_cthelper UAPI,
         from Dmitry V. Levin.
      
      2) Remove extra space in deprecated automatic helper assignment
         notice, from Klemen Košir.
      
      3) Drop early socket demux socket after NAT mangling, from
         Florian Westphal. Add a test to exercise this bug.
      
      4) Fix bogus invalid packet report in the conntrack TCP tracker,
         also from Florian.
      
      5) Fix access to xt[NFPROTO_UNSPEC] list with no mutex
         in target/match_revfn(), from Vasily Averin.
      
      6) Disallow updates on the table ownership flag.
      
      7) Fix double hook unregistration of tables with owner.
      
      8) Remove bogus check on the table owner in __nft_release_tables().
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9270bbe2
  5. 05 Mar, 2021 15 commits
    • Jakub Kicinski's avatar
      ethernet: alx: fix order of calls on resume · a4dcfbc4
      Jakub Kicinski authored
      netif_device_attach() will unpause the queues so we can't call
      it before __alx_open(). This went undetected until
      commit b0999223 ("alx: add ability to allocate and free
      alx_napi structures") but now if stack tries to xmit immediately
      on resume before __alx_open() we'll crash on the NAPI being null:
      
       BUG: kernel NULL pointer dereference, address: 0000000000000198
       CPU: 0 PID: 12 Comm: ksoftirqd/0 Tainted: G           OE 5.10.0-3-amd64 #1 Debian 5.10.13-1
       Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./H77-D3H, BIOS F15 11/14/2013
       RIP: 0010:alx_start_xmit+0x34/0x650 [alx]
       Code: 41 56 41 55 41 54 55 53 48 83 ec 20 0f b7 57 7c 8b 8e b0
      0b 00 00 39 ca 72 06 89 d0 31 d2 f7 f1 89 d2 48 8b 84 df
       RSP: 0018:ffffb09240083d28 EFLAGS: 00010297
       RAX: 0000000000000000 RBX: ffffa04d80ae7800 RCX: 0000000000000004
       RDX: 0000000000000000 RSI: ffffa04d80afa000 RDI: ffffa04e92e92a00
       RBP: 0000000000000042 R08: 0000000000000100 R09: ffffa04ea3146700
       R10: 0000000000000014 R11: 0000000000000000 R12: ffffa04e92e92100
       R13: 0000000000000001 R14: ffffa04e92e92a00 R15: ffffa04e92e92a00
       FS:  0000000000000000(0000) GS:ffffa0508f600000(0000) knlGS:0000000000000000
       i915 0000:00:02.0: vblank wait timed out on crtc 0
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000198 CR3: 000000004460a001 CR4: 00000000001706f0
       Call Trace:
        dev_hard_start_xmit+0xc7/0x1e0
        sch_direct_xmit+0x10f/0x310
      
      Cc: <stable@vger.kernel.org> # 4.9+
      Fixes: bc2bebe8 ("alx: remove WoL support")
      Reported-by: default avatarZbynek Michl <zbynek.michl@gmail.com>
      Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983595Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Tested-by: default avatarZbynek Michl <zbynek.michl@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a4dcfbc4
    • George McCollister's avatar
      lan743x: trim all 4 bytes of the FCS; not just 2 · 3e21a10f
      George McCollister authored
      Trim all 4 bytes of the received FCS; not just 2 of them. Leaving 2
      bytes of the FCS on the frame breaks DSA tailing tag drivers.
      
      Fixes: a8db76d4 ("lan743x: boost performance on cpu archs w/o dma cache snooping")
      Signed-off-by: default avatarGeorge McCollister <george.mccollister@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3e21a10f
    • Michael Braun's avatar
      gianfar: fix jumbo packets+napi+rx overrun crash · d8861bab
      Michael Braun authored
      When using jumbo packets and overrunning rx queue with napi enabled,
      the following sequence is observed in gfar_add_rx_frag:
      
         | lstatus                              |       | skb                   |
      t  | lstatus,  size, flags                | first | len, data_len, *ptr   |
      ---+--------------------------------------+-------+-----------------------+
      13 | 18002348, 9032, INTERRUPT LAST       | 0     | 9600, 8000,  f554c12e |
      12 | 10000640, 1600, INTERRUPT            | 0     | 8000, 6400,  f554c12e |
      11 | 10000640, 1600, INTERRUPT            | 0     | 6400, 4800,  f554c12e |
      10 | 10000640, 1600, INTERRUPT            | 0     | 4800, 3200,  f554c12e |
      09 | 10000640, 1600, INTERRUPT            | 0     | 3200, 1600,  f554c12e |
      08 | 14000640, 1600, INTERRUPT FIRST      | 0     | 1600, 0,     f554c12e |
      07 | 14000640, 1600, INTERRUPT FIRST      | 1     | 0,    0,     f554c12e |
      06 | 1c000080, 128,  INTERRUPT LAST FIRST | 1     | 0,    0,     abf3bd6e |
      05 | 18002348, 9032, INTERRUPT LAST       | 0     | 8000, 6400,  c5a57780 |
      04 | 10000640, 1600, INTERRUPT            | 0     | 6400, 4800,  c5a57780 |
      03 | 10000640, 1600, INTERRUPT            | 0     | 4800, 3200,  c5a57780 |
      02 | 10000640, 1600, INTERRUPT            | 0     | 3200, 1600,  c5a57780 |
      01 | 10000640, 1600, INTERRUPT            | 0     | 1600, 0,     c5a57780 |
      00 | 14000640, 1600, INTERRUPT FIRST      | 1     | 0,    0,     c5a57780 |
      
      So at t=7 a new packets is started but not finished, probably due to rx
      overrun - but rx overrun is not indicated in the flags. Instead a new
      packets starts at t=8. This results in skb->len to exceed size for the LAST
      fragment at t=13 and thus a negative fragment size added to the skb.
      
      This then crashes:
      
      kernel BUG at include/linux/skbuff.h:2277!
      Oops: Exception in kernel mode, sig: 5 [#1]
      ...
      NIP [c04689f4] skb_pull+0x2c/0x48
      LR [c03f62ac] gfar_clean_rx_ring+0x2e4/0x844
      Call Trace:
      [ec4bfd38] [c06a84c4] _raw_spin_unlock_irqrestore+0x60/0x7c (unreliable)
      [ec4bfda8] [c03f6a44] gfar_poll_rx_sq+0x48/0xe4
      [ec4bfdc8] [c048d504] __napi_poll+0x54/0x26c
      [ec4bfdf8] [c048d908] net_rx_action+0x138/0x2c0
      [ec4bfe68] [c06a8f34] __do_softirq+0x3a4/0x4fc
      [ec4bfed8] [c0040150] run_ksoftirqd+0x58/0x70
      [ec4bfee8] [c0066ecc] smpboot_thread_fn+0x184/0x1cc
      [ec4bff08] [c0062718] kthread+0x140/0x144
      [ec4bff38] [c0012350] ret_from_kernel_thread+0x14/0x1c
      
      This patch fixes this by checking for computed LAST fragment size, so a
      negative sized fragment is never added.
      In order to prevent the newer rx frame from getting corrupted, the FIRST
      flag is checked to discard the incomplete older frame.
      Signed-off-by: default avatarMichael Braun <michael-dev@fami-braun.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d8861bab
    • Denis Efremov's avatar
      sun/niu: fix wrong RXMAC_BC_FRM_CNT_COUNT count · 155b23e6
      Denis Efremov authored
      RXMAC_BC_FRM_CNT_COUNT added to mp->rx_bcasts twice in a row
      in niu_xmac_interrupt(). Remove the second addition.
      Signed-off-by: default avatarDenis Efremov <efremov@linux.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      155b23e6
    • Denis Efremov's avatar
      net/hamradio/6pack: remove redundant check in sp_encaps() · 85554bcd
      Denis Efremov authored
      "len > sp->mtu" checked twice in a row in sp_encaps().
      Remove the second check.
      Signed-off-by: default avatarDenis Efremov <efremov@linux.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      85554bcd
    • Hayes Wang's avatar
      r8169: fix r8168fp_adjust_ocp_cmd function · abbf9a0e
      Hayes Wang authored
      The (0xBAF70000 & 0x00FFF000) << 6 should be (0xf70 << 18).
      
      Fixes: 561535b0 ("r8169: fix OCP access on RTL8117")
      Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
      Acked-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      abbf9a0e
    • Xu Wang's avatar
      selftest/net/ipsec.c: Remove unneeded semicolon · 0a7e0c3b
      Xu Wang authored
      fix semicolon.cocci warning:
      tools/testing/selftests/net/ipsec.c:1788:2-3: Unneeded semicolon
      Signed-off-by: default avatarXu Wang <vulab@iscas.ac.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0a7e0c3b
    • Junlin Yang's avatar
      ibmvnic: remove excessive irqsave · 69cdb794
      Junlin Yang authored
      ibmvnic_remove locks multiple spinlocks while disabling interrupts:
      spin_lock_irqsave(&adapter->state_lock, flags);
      spin_lock_irqsave(&adapter->rwi_lock, flags);
      
      As reported by coccinelle, the second _irqsave() overwrites the value
      saved in 'flags' by the first _irqsave(),   therefore when the second
      _irqrestore() comes,the value in 'flags' is not valid,the value saved
      by the first _irqsave() has been lost.
      This likely leads to IRQs remaining disabled. So remove the second
      _irqsave():
      spin_lock_irqsave(&adapter->state_lock, flags);
      spin_lock(&adapter->rwi_lock);
      
      Generated by: ./scripts/coccinelle/locks/flags.cocci
      ./drivers/net/ethernet/ibm/ibmvnic.c:5413:1-18:
      ERROR: nested lock+irqsave that reuses flags from line 5404.
      
      Fixes: 4a41c421 ("ibmvnic: serialize access to work queue on remove")
      Signed-off-by: default avatarJunlin Yang <yangjunlin@yulong.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      69cdb794
    • Sergey Nazarov's avatar
      CIPSO: Fix unaligned memory access in cipso_v4_gentag_hdr · e233febd
      Sergey Nazarov authored
      We need to use put_unaligned when writing 32-bit DOI value
      in cipso_v4_gentag_hdr to avoid unaligned memory access.
      
      v2: unneeded type cast removed as Ondrej Mosnacek suggested.
      Signed-off-by: default avatarSergey Nazarov <s-nazarov@yandex.ru>
      Acked-by: default avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e233febd
    • Wong Vee Khee's avatar
      stmmac: intel: Fixes clock registration error seen for multiple interfaces · 8eb37ab7
      Wong Vee Khee authored
      Issue seen when enumerating multiple Intel mGbE interfaces in EHL.
      
      [    6.898141] intel-eth-pci 0000:00:1d.2: enabling device (0000 -> 0002)
      [    6.900971] intel-eth-pci 0000:00:1d.2: Fail to register stmmac-clk
      [    6.906434] intel-eth-pci 0000:00:1d.2: User ID: 0x51, Synopsys ID: 0x52
      
      We fix it by making the clock name to be unique following the format
      of stmmac-pci_name(pci_dev) so that we can differentiate the clock for
      these Intel mGbE interfaces in EHL platform as follow:
      
        /sys/kernel/debug/clk/stmmac-0000:00:1d.1
        /sys/kernel/debug/clk/stmmac-0000:00:1d.2
        /sys/kernel/debug/clk/stmmac-0000:00:1e.4
      
      Fixes: 58da0cfa ("net: stmmac: create dwmac-intel.c to contain all Intel platform")
      Signed-off-by: default avatarWong Vee Khee <vee.khee.wong@intel.com>
      Signed-off-by: default avatarVoon Weifeng <weifeng.voon@intel.com>
      Co-developed-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8eb37ab7
    • Ong Boon Leong's avatar
      net: stmmac: Fix VLAN filter delete timeout issue in Intel mGBE SGMII · 9a7b3950
      Ong Boon Leong authored
      For Intel mGbE controller, MAC VLAN filter delete operation will time-out
      if serdes power-down sequence happened first during driver remove() with
      below message.
      
      [82294.764958] intel-eth-pci 0000:00:1e.4 eth2: stmmac_dvr_remove: removing driver
      [82294.778677] intel-eth-pci 0000:00:1e.4 eth2: Timeout accessing MAC_VLAN_Tag_Filter
      [82294.779997] intel-eth-pci 0000:00:1e.4 eth2: failed to kill vid 0081/0
      [82294.947053] intel-eth-pci 0000:00:1d.2 eth1: stmmac_dvr_remove: removing driver
      [82295.002091] intel-eth-pci 0000:00:1d.1 eth0: stmmac_dvr_remove: removing driver
      
      Therefore, we delay the serdes power-down to be after unregister_netdev()
      which triggers the VLAN filter delete.
      
      Fixes: b9663b7c ("net: stmmac: Enable SERDES power up/down sequence")
      Signed-off-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9a7b3950
    • Jia-Ju Bai's avatar
      net: intel: iavf: fix error return code of iavf_init_get_resources() · 6650d31f
      Jia-Ju Bai authored
      When iavf_process_config() fails, no error return code of
      iavf_init_get_resources() is assigned.
      To fix this bug, err is assigned with the return value of
      iavf_process_config(), and then err is checked.
      Reported-by: default avatarTOTE Robot <oslab@tsinghua.edu.cn>
      Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6650d31f
    • Jia-Ju Bai's avatar
      net: tehuti: fix error return code in bdx_probe() · 38c26ff3
      Jia-Ju Bai authored
      When bdx_read_mac() fails, no error return code of bdx_probe()
      is assigned.
      To fix this bug, err is assigned with -EFAULT as error return code.
      Reported-by: default avatarTOTE Robot <oslab@tsinghua.edu.cn>
      Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      38c26ff3
    • Kevin(Yudong) Yang's avatar
      net/mlx4_en: update moderation when config reset · 00ff801b
      Kevin(Yudong) Yang authored
      This patch fixes a bug that the moderation config will not be
      applied when calling mlx4_en_reset_config. For example, when
      turning on rx timestamping, mlx4_en_reset_config() will be called,
      causing the NIC to forget previous moderation config.
      
      This fix is in phase with a previous fix:
      commit 79c54b6b ("net/mlx4_en: Fix TX moderation info loss
      after set_ringparam is called")
      
      Tested: Before this patch, on a host with NIC using mlx4, run
      netserver and stream TCP to the host at full utilization.
      $ sar -I SUM 1
                       INTR    intr/s
      14:03:56          sum  48758.00
      
      After rx hwtstamp is enabled:
      $ sar -I SUM 1
      14:10:38          sum 317771.00
      We see the moderation is not working properly and issued 7x more
      interrupts.
      
      After the patch, and turned on rx hwtstamp, the rate of interrupts
      is as expected:
      $ sar -I SUM 1
      14:52:11          sum  49332.00
      
      Fixes: 79c54b6b ("net/mlx4_en: Fix TX moderation info loss after set_ringparam is called")
      Signed-off-by: default avatarKevin(Yudong) Yang <yyd@google.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarNeal Cardwell <ncardwell@google.com>
      CC: Tariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      00ff801b
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · 638526bb
      David S. Miller authored
      Alexei Starovoitov says:
      
      ====================
      pull-request: bpf 2021-03-04
      
      The following pull-request contains BPF updates for your *net* tree.
      
      We've added 7 non-merge commits during the last 4 day(s) which contain
      a total of 9 files changed, 128 insertions(+), 40 deletions(-).
      
      The main changes are:
      
      1) Fix 32-bit cmpxchg, from Brendan.
      
      2) Fix atomic+fetch logic, from Ilya.
      
      3) Fix usage of bpf_csum_diff in selftests, from Yauheni.
      ====================
      638526bb