1. 25 5月, 2021 7 次提交
    • V
      net: dsa: sja1105: use 4095 as the private VLAN for untagged traffic · ed040abc
      Vladimir Oltean 提交于
      One thing became visible when writing the blamed commit, and that was
      that STP and PTP frames injected by net/dsa/tag_sja1105.c using the
      deferred xmit mechanism are always classified to the pvid of the CPU
      port, regardless of whatever VLAN there might be in these packets.
      
      So a decision needed to be taken regarding the mechanism through which
      we should ensure that delivery of STP and PTP traffic is possible when
      we are in a VLAN awareness mode that involves tag_8021q. This is because
      tag_8021q is not concerned with managing the pvid of the CPU port, since
      as far as tag_8021q is concerned, no traffic should be sent as untagged
      from the CPU port. So we end up not actually having a pvid on the CPU
      port if we only listen to tag_8021q, and unless we do something about it.
      
      The decision taken at the time was to keep VLAN 1 in the list of
      priv->dsa_8021q_vlans, and make it a pvid of the CPU port. This ensures
      that STP and PTP frames can always be sent to the outside world.
      
      However there is a problem. If we do the following while we are in
      the best_effort_vlan_filtering=true mode:
      
      ip link add br0 type bridge vlan_filtering 1
      ip link set swp2 master br0
      bridge vlan del dev swp2 vid 1
      
      Then untagged and pvid-tagged frames should be dropped. But we observe
      that they aren't, and this is because of the precaution we took that VID
      1 is always installed on all ports.
      
      So clearly VLAN 1 is not good for this purpose. What about VLAN 0?
      Well, VLAN 0 is managed by the 8021q module, and that module wants to
      ensure that 802.1p tagged frames are always received by a port, and are
      always transmitted as VLAN-tagged (with VLAN ID 0). Whereas we want our
      STP and PTP frames to be untagged if the stack sent them as untagged -
      we don't want the driver to just decide out of the blue that it adds
      VID 0 to some packets.
      
      So what to do?
      
      Well, there is one other VLAN that is reserved, and that is 4095:
      $ ip link add link swp2 name swp2.4095 type vlan id 4095
      Error: 8021q: Invalid VLAN id.
      $ bridge vlan add dev swp2 vid 4095
      Error: bridge: Vlan id is invalid.
      
      After we made this change, VLAN 1 is indeed forwarded and/or dropped
      according to the bridge VLAN table, there are no further alterations
      done by the sja1105 driver.
      
      Fixes: ec5ae610 ("net: dsa: sja1105: save/restore VLANs using a delta commit method")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ed040abc
    • V
      net: dsa: sja1105: error out on unsupported PHY mode · 6729188d
      Vladimir Oltean 提交于
      The driver continues probing when a port is configured for an
      unsupported PHY interface type, instead it should stop.
      
      Fixes: 8aa9ebcc ("net: dsa: Introduce driver for NXP SJA1105 5-port L2 switch")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6729188d
    • V
      net: dsa: sja1105: add error handling in sja1105_setup() · cec279a8
      Vladimir Oltean 提交于
      If any of sja1105_static_config_load(), sja1105_clocking_setup() or
      sja1105_devlink_setup() fails, we can't just return in the middle of
      sja1105_setup() or memory will leak. Add a cleanup path.
      
      Fixes: 0a7bdbc2 ("net: dsa: sja1105: move devlink param code to sja1105_devlink.c")
      Fixes: 8aa9ebcc ("net: dsa: Introduce driver for NXP SJA1105 5-port L2 switch")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cec279a8
    • V
      net: dsa: sja1105: call dsa_unregister_switch when allocating memory fails · dc596e3f
      Vladimir Oltean 提交于
      Unlike other drivers which pretty much end their .probe() execution with
      dsa_register_switch(), the sja1105 does some extra stuff. When that
      fails with -ENOMEM, the driver is quick to return that, forgetting to
      call dsa_unregister_switch(). Not critical, but a bug nonetheless.
      
      Fixes: 4d752508 ("net: dsa: sja1105: offload the Credit-Based Shaper qdisc")
      Fixes: a68578c2 ("net: dsa: Make deferred_xmit private to sja1105")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dc596e3f
    • V
      net: dsa: sja1105: fix VL lookup command packing for P/Q/R/S · ba61cf16
      Vladimir Oltean 提交于
      At the beginning of the sja1105_dynamic_config.c file there is a diagram
      of the dynamic config interface layout:
      
       packed_buf
      
       |
       V
       +-----------------------------------------+------------------+
       |              ENTRY BUFFER               |  COMMAND BUFFER  |
       +-----------------------------------------+------------------+
      
       <----------------------- packed_size ------------------------>
      
      So in order to pack/unpack the command bits into the buffer,
      sja1105_vl_lookup_cmd_packing must first advance the buffer pointer by
      the length of the entry. This is similar to what the other *cmd_packing
      functions do.
      
      This bug exists because the command packing function for P/Q/R/S was
      copied from the E/T generation, and on E/T, the command was actually
      embedded within the entry buffer itself.
      
      Fixes: 94f94d4a ("net: dsa: sja1105: add static tables for virtual links")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ba61cf16
    • J
      net: hso: fix control-request directions · 1a6e9a9c
      Johan Hovold 提交于
      The direction of the pipe argument must match the request-type direction
      bit or control requests may fail depending on the host-controller-driver
      implementation.
      
      Fix the tiocmset and rfkill requests which erroneously used
      usb_rcvctrlpipe().
      
      Fixes: 72dc1c09 ("HSO: add option hso driver")
      Cc: stable@vger.kernel.org      # 2.6.27
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1a6e9a9c
    • H
      r8152: check the informaton of the device · 1a44fb38
      Hayes Wang 提交于
      Verify some fields of the USB descriptor to make sure the driver
      could be used by the device.
      
      Besides, remove the check of endpoint number in rtl8152_probe().
      usb_find_common_endpoints() includes it.
      
      BugLink: https://syzkaller.appspot.com/bug?id=912c9c373656996801b4de61f1e3cb326fe940aa
      Reported-by: syzbot+95afd23673f5dd295c57@syzkaller.appspotmail.com
      Fixes: c2198943 ("r8152: search the configuration of vendor mode")
      Signed-off-by: NHayes Wang <hayeswang@realtek.com>
      Reviewed-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1a44fb38
  2. 24 5月, 2021 4 次提交
    • A
      NFC: nfcmrvl: fix kernel-doc syntax in file headers · 4dd649d1
      Aditya Srivastava 提交于
      The opening comment mark '/**' is used for highlighting the beginning of
      kernel-doc comments.
      The header for drivers/nfc/nfcmrvl follows this syntax, but the content
      inside does not comply with kernel-doc.
      
      This line was probably not meant for kernel-doc parsing, but is parsed
      due to the presence of kernel-doc like comment syntax(i.e, '/**'), which
      causes unexpected warnings from kernel-doc.
      For e.g., running scripts/kernel-doc -none on drivers/nfc/nfcmrvl/spi.c
      causes warning:
      warning: expecting prototype for Marvell NFC(). Prototype was for SPI_WAIT_HANDSHAKE() instead
      
      Provide a simple fix by replacing such occurrences with general comment
      format, i.e. '/*', to prevent kernel-doc from parsing it.
      Signed-off-by: NAditya Srivastava <yashsri421@gmail.com>
      Acked-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4dd649d1
    • D
      net: dsa: mt7530: fix VLAN traffic leaks · 474a2dda
      DENG Qingfang 提交于
      PCR_MATRIX field was set to all 1's when VLAN filtering is enabled, but
      was not reset when it is disabled, which may cause traffic leaks:
      
      	ip link add br0 type bridge vlan_filtering 1
      	ip link add br1 type bridge vlan_filtering 1
      	ip link set swp0 master br0
      	ip link set swp1 master br1
      	ip link set br0 type bridge vlan_filtering 0
      	ip link set br1 type bridge vlan_filtering 0
      	# traffic in br0 and br1 will start leaking to each other
      
      As port_bridge_{add,del} have set up PCR_MATRIX properly, remove the
      PCR_MATRIX write from mt7530_port_set_vlan_aware.
      
      Fixes: 83163f7d ("net: dsa: mediatek: add VLAN support for MT7530")
      Signed-off-by: NDENG Qingfang <dqfext@gmail.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      474a2dda
    • Z
      net: macb: ensure the device is available before accessing GEMGXL control registers · 5eff1461
      Zong Li 提交于
      If runtime power menagement is enabled, the gigabit ethernet PLL would
      be disabled after macb_probe(). During this period of time, the system
      would hang up if we try to access GEMGXL control registers.
      
      We can't put runtime_pm_get/runtime_pm_put/ there due to the issue of
      sleep inside atomic section (7fa2955f ("sh_eth: Fix sleeping
      function called from invalid context"). Add netif_running checking to
      ensure the device is available before accessing GEMGXL device.
      
      Changed in v2:
       - Use netif_running instead of its own flag
      Signed-off-by: NZong Li <zong.li@sifive.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5eff1461
    • S
      net: ethernet: mtk_eth_soc: Fix packet statistics support for MT7628/88 · ad79fd2c
      Stefan Roese 提交于
      The MT7628/88 SoC(s) have other (limited) packet counter registers than
      currently supported in the mtk_eth_soc driver. This patch adds support
      for reading these registers, so that the packet statistics are correctly
      updated.
      
      Additionally the defines for the non-MT7628 variant packet counter
      registers are added and used in this patch instead of using hard coded
      values.
      Signed-off-by: NStefan Roese <sr@denx.de>
      Fixes: 296c9120 ("net: ethernet: mediatek: Add MT7628/88 SoC support")
      Cc: Felix Fietkau <nbd@nbd.name>
      Cc: John Crispin <john@phrozen.org>
      Cc: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Cc: Reto Schneider <code@reto-schneider.ch>
      Cc: Reto Schneider <reto.schneider@husqvarnagroup.com>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ad79fd2c
  3. 22 5月, 2021 4 次提交
    • Í
      net:sfc: fix non-freed irq in legacy irq mode · 8f03eeb6
      Íñigo Huguet 提交于
      SFC driver can be configured via modparam to work using MSI-X, MSI or
      legacy IRQ interrupts. In the last one, the interrupt was not properly
      released on module remove.
      
      It was not freed because the flag irqs_hooked was not set during
      initialization in the case of using legacy IRQ.
      
      Example of (trimmed) trace during module remove without this fix:
      
      remove_proc_entry: removing non-empty directory 'irq/125', leaking at least '0000:3b:00.1'
      WARNING: CPU: 39 PID: 3658 at fs/proc/generic.c:715 remove_proc_entry+0x15c/0x170
      ...trimmed...
      Call Trace:
       unregister_irq_proc+0xe3/0x100
       free_desc+0x29/0x70
       irq_free_descs+0x47/0x70
       mp_unmap_irq+0x58/0x60
       acpi_unregister_gsi_ioapic+0x2a/0x40
       acpi_pci_irq_disable+0x78/0xb0
       pci_disable_device+0xd1/0x100
       efx_pci_remove+0xa1/0x1e0 [sfc]
       pci_device_remove+0x38/0xa0
       __device_release_driver+0x177/0x230
       driver_detach+0xcb/0x110
       bus_remove_driver+0x58/0xd0
       pci_unregister_driver+0x2a/0xb0
       efx_exit_module+0x24/0xf40 [sfc]
       __do_sys_delete_module.constprop.0+0x171/0x280
       ? exit_to_user_mode_prepare+0x83/0x1d0
       do_syscall_64+0x3d/0x80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x7f9f9385800b
      ...trimmed...
      Signed-off-by: NÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8f03eeb6
    • A
      net: lantiq: fix memory corruption in RX ring · c7718ee9
      Aleksander Jan Bajkowski 提交于
      In a situation where memory allocation or dma mapping fails, an
      invalid address is programmed into the descriptor. This can lead
      to memory corruption. If the memory allocation fails, DMA should
      reuse the previous skb and mapping and drop the packet. This patch
      also increments rx drop counter.
      
      Fixes: fe1a5642 ("net: lantiq: Add Lantiq / Intel VRX200 Ethernet driver ")
      Signed-off-by: NAleksander Jan Bajkowski <olek2@wp.pl>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c7718ee9
    • F
      net: dsa: bcm_sf2: Fix bcm_sf2_reg_rgmii_cntrl() call for non-RGMII port · fc516d3a
      Florian Fainelli 提交于
      We cannot call bcm_sf2_reg_rgmii_cntrl() for a port that is not RGMII,
      yet we do that in bcm_sf2_sw_mac_link_up() irrespective of the port's
      interface. Move that read until we have properly qualified the PHY
      interface mode. This avoids triggering a warning on 7278 platforms that
      have GMII ports.
      
      Fixes: 55cfeb39 ("net: dsa: bcm_sf2: add function finding RGMII register")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Acked-by: NRafał Miłecki <rafal@milecki.pl>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fc516d3a
    • S
      net: ethernet: mtk_eth_soc: Fix DIM support for MT7628/88 · 430bfe05
      Stefan Roese 提交于
      When updating to latest mainline for some testing on the GARDENA smart
      gateway based on the MT7628, I noticed that ethernet does not work any
      more. Commit e9229ffd ("net: ethernet: mtk_eth_soc: implement
      dynamic interrupt moderation") introduced this problem, as it missed the
      RX_DIM & TX_DIM configuration for this SoC variant. This patch fixes
      this by calling mtk_dim_rx() & mtk_dim_tx() in this case as well.
      Signed-off-by: NStefan Roese <sr@denx.de>
      Fixes: e9229ffd ("net: ethernet: mtk_eth_soc: implement dynamic interrupt moderation")
      Cc: Felix Fietkau <nbd@nbd.name>
      Cc: John Crispin <john@phrozen.org>
      Cc: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Cc: Reto Schneider <code@reto-schneider.ch>
      Cc: Reto Schneider <reto.schneider@husqvarnagroup.com>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      430bfe05
  4. 21 5月, 2021 5 次提交
    • J
      net: stmmac: fix system hang if change mac address after interface ifdown · 4691ffb1
      Joakim Zhang 提交于
      Fix system hang with below sequences:
      ~# ifconfig ethx down
      ~# ifconfig ethx hw ether xx:xx:xx:xx:xx:xx
      
      After ethx down, stmmac all clocks gated off and then register access causes
      system hang.
      
      Fixes: 5ec55823 ("net: stmmac: add clocks management for gmac driver")
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4691ffb1
    • J
      net: stmmac: correct clocks enabled in stmmac_vlan_rx_kill_vid() · b3dcb312
      Joakim Zhang 提交于
      This should be a mistake to fix conflicts when removing RFC tag to
      repost the patch.
      
      Fixes: 5ec55823 ("net: stmmac: add clocks management for gmac driver")
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b3dcb312
    • Z
      net/qla3xxx: fix schedule while atomic in ql_sem_spinlock · 13a6f315
      Zheyu Ma 提交于
      When calling the 'ql_sem_spinlock', the driver has already acquired the
      spin lock, so the driver should not call 'ssleep' in atomic context.
      
      This bug can be fixed by using 'mdelay' instead of 'ssleep'.
      
      The KASAN's log reveals it:
      
      [    3.238124 ] BUG: scheduling while atomic: swapper/0/1/0x00000002
      [    3.238748 ] 2 locks held by swapper/0/1:
      [    3.239151 ]  #0: ffff88810177b240 (&dev->mutex){....}-{3:3}, at:
      __device_driver_lock+0x41/0x60
      [    3.240026 ]  #1: ffff888107c60e28 (&qdev->hw_lock){....}-{2:2}, at:
      ql3xxx_probe+0x2aa/0xea0
      [    3.240873 ] Modules linked in:
      [    3.241187 ] irq event stamp: 460854
      [    3.241541 ] hardirqs last  enabled at (460853): [<ffffffff843051bf>]
      _raw_spin_unlock_irqrestore+0x4f/0x70
      [    3.242245 ] hardirqs last disabled at (460854): [<ffffffff843058ca>]
      _raw_spin_lock_irqsave+0x2a/0x70
      [    3.242245 ] softirqs last  enabled at (446076): [<ffffffff846002e4>]
      __do_softirq+0x2e4/0x4b1
      [    3.242245 ] softirqs last disabled at (446069): [<ffffffff811ba5e0>]
      irq_exit_rcu+0x100/0x110
      [    3.242245 ] Preemption disabled at:
      [    3.242245 ] [<ffffffff828ca5ba>] ql3xxx_probe+0x2aa/0xea0
      [    3.242245 ] Kernel panic - not syncing: scheduling while atomic
      [    3.242245 ] CPU: 2 PID: 1 Comm: swapper/0 Not tainted
      5.13.0-rc1-00145
      -gee7dc339169-dirty #16
      [    3.242245 ] Call Trace:
      [    3.242245 ]  dump_stack+0xba/0xf5
      [    3.242245 ]  ? ql3xxx_probe+0x1f0/0xea0
      [    3.242245 ]  panic+0x15a/0x3f2
      [    3.242245 ]  ? vprintk+0x76/0x150
      [    3.242245 ]  ? ql3xxx_probe+0x2aa/0xea0
      [    3.242245 ]  __schedule_bug+0xae/0xe0
      [    3.242245 ]  __schedule+0x72e/0xa00
      [    3.242245 ]  schedule+0x43/0xf0
      [    3.242245 ]  schedule_timeout+0x28b/0x500
      [    3.242245 ]  ? del_timer_sync+0xf0/0xf0
      [    3.242245 ]  ? msleep+0x2f/0x70
      [    3.242245 ]  msleep+0x59/0x70
      [    3.242245 ]  ql3xxx_probe+0x307/0xea0
      [    3.242245 ]  ? _raw_spin_unlock_irqrestore+0x3a/0x70
      [    3.242245 ]  ? pci_device_remove+0x110/0x110
      [    3.242245 ]  local_pci_probe+0x45/0xa0
      [    3.242245 ]  pci_device_probe+0x12b/0x1d0
      [    3.242245 ]  really_probe+0x2a9/0x610
      [    3.242245 ]  driver_probe_device+0x90/0x1d0
      [    3.242245 ]  ? mutex_lock_nested+0x1b/0x20
      [    3.242245 ]  device_driver_attach+0x68/0x70
      [    3.242245 ]  __driver_attach+0x124/0x1b0
      [    3.242245 ]  ? device_driver_attach+0x70/0x70
      [    3.242245 ]  bus_for_each_dev+0xbb/0x110
      [    3.242245 ]  ? rdinit_setup+0x45/0x45
      [    3.242245 ]  driver_attach+0x27/0x30
      [    3.242245 ]  bus_add_driver+0x1eb/0x2a0
      [    3.242245 ]  driver_register+0xa9/0x180
      [    3.242245 ]  __pci_register_driver+0x82/0x90
      [    3.242245 ]  ? yellowfin_init+0x25/0x25
      [    3.242245 ]  ql3xxx_driver_init+0x23/0x25
      [    3.242245 ]  do_one_initcall+0x7f/0x3d0
      [    3.242245 ]  ? rdinit_setup+0x45/0x45
      [    3.242245 ]  ? rcu_read_lock_sched_held+0x4f/0x80
      [    3.242245 ]  kernel_init_freeable+0x2aa/0x301
      [    3.242245 ]  ? rest_init+0x2c0/0x2c0
      [    3.242245 ]  kernel_init+0x18/0x190
      [    3.242245 ]  ? rest_init+0x2c0/0x2c0
      [    3.242245 ]  ? rest_init+0x2c0/0x2c0
      [    3.242245 ]  ret_from_fork+0x1f/0x30
      [    3.242245 ] Dumping ftrace buffer:
      [    3.242245 ]    (ftrace buffer empty)
      [    3.242245 ] Kernel Offset: disabled
      [    3.242245 ] Rebooting in 1 seconds.
      Reported-by: NZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: NZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      13a6f315
    • A
      net: encx24j600: fix kernel-doc syntax in file headers · 503c599a
      Aditya Srivastava 提交于
      The opening comment mark '/**' is used for highlighting the beginning of
      kernel-doc comments.
      The header for drivers/net/ethernet/microchip/encx24j600 files follows
      this syntax, but the content inside does not comply with kernel-doc.
      
      This line was probably not meant for kernel-doc parsing, but is parsed
      due to the presence of kernel-doc like comment syntax(i.e, '/**'), which
      causes unexpected warning from kernel-doc.
      For e.g., running scripts/kernel-doc -none
      drivers/net/ethernet/microchip/encx24j600_hw.h emits:
      warning: expecting prototype for h(). Prototype was for _ENCX24J600_HW_H() instead
      
      Provide a simple fix by replacing such occurrences with general comment
      format, i.e. '/*', to prevent kernel-doc from parsing it.
      Signed-off-by: NAditya Srivastava <yashsri421@gmail.com>
      Acked-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      503c599a
    • J
      ixgbe: fix large MTU request from VF · 63e39d29
      Jesse Brandeburg 提交于
      Check that the MTU value requested by the VF is in the supported
      range of MTUs before attempting to set the VF large packet enable,
      otherwise reject the request. This also avoids unnecessary
      register updates in the case of the 82599 controller.
      
      Fixes: 872844dd ("ixgbe: Enable jumbo frames support w/ SR-IOV")
      Co-developed-by: NPiotr Skajewski <piotrx.skajewski@intel.com>
      Signed-off-by: NPiotr Skajewski <piotrx.skajewski@intel.com>
      Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Co-developed-by: NMateusz Palczewski <mateusz.palczewski@intel.com>
      Signed-off-by: NMateusz Palczewski <mateusz.palczewski@intel.com>
      Tested-by: NKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      63e39d29
  5. 20 5月, 2021 2 次提交
  6. 19 5月, 2021 18 次提交