Skip to content
  1. Sep 29, 2021
    • Florian Fainelli's avatar
      net: phy: bcm7xxx: Fixed indirect MMD operations · d88fd1b5
      Florian Fainelli authored
      When EEE support was added to the 28nm EPHY it was assumed that it would
      be able to support the standard clause 45 over clause 22 register access
      method. It turns out that the PHY does not support that, which is the
      very reason for using the indirect shadow mode 2 bank 3 access method.
      
      Implement {read,write}_mmd to allow the standard PHY library routines
      pertaining to EEE querying and configuration to work correctly on these
      PHYs. This forces us to implement a __phy_set_clr_bits() function that
      does not grab the MDIO bus lock since the PHY driver's {read,write}_mmd
      functions are always called with that lock held.
      
      Fixes: 83ee102a
      
       ("net: phy: bcm7xxx: add support for 28nm EPHY")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d88fd1b5
    • David S. Miller's avatar
      Merge branch 'hns3-fixes' · 251ffc07
      David S. Miller authored
      
      
      Guangbin Huang says:
      
      ====================
      net: hns3: add some fixes for -net
      
      This series adds some fixes for the HNS3 ethernet driver.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      251ffc07
    • Guangbin Huang's avatar
      net: hns3: disable firmware compatible features when uninstall PF · 0178839c
      Guangbin Huang authored
      Currently, the firmware compatible features are enabled in PF driver
      initialization process, but they are not disabled in PF driver
      deinitialization process and firmware keeps these features in enabled
      status.
      
      In this case, if load an old PF driver (for example, in VM) which not
      support the firmware compatible features, firmware will still send mailbox
      message to PF when link status changed and PF will print
      "un-supported mailbox message, code = 201".
      
      To fix this problem, disable these firmware compatible features in PF
      driver deinitialization process.
      
      Fixes: ed8fb4b2
      
       ("net: hns3: add link change event report")
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0178839c
    • Guangbin Huang's avatar
      net: hns3: fix always enable rx vlan filter problem after selftest · 27bf4af6
      Guangbin Huang authored
      Currently, the rx vlan filter will always be disabled before selftest and
      be enabled after selftest as the rx vlan filter feature is fixed on in
      old device earlier than V3.
      
      However, this feature is not fixed in some new devices and it can be
      disabled by user. In this case, it is wrong if rx vlan filter is enabled
      after selftest. So fix it.
      
      Fixes: bcc26e8d
      
       ("net: hns3: remove unused code in hns3_self_test()")
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      27bf4af6
    • Guangbin Huang's avatar
      net: hns3: PF enable promisc for VF when mac table is overflow · 276e6042
      Guangbin Huang authored
      If unicast mac address table is full, and user add a new mac address, the
      unicast promisc needs to be enabled for the new unicast mac address can be
      used. So does the multicast promisc.
      
      Now this feature has been implemented for PF, and VF should be implemented
      too. When the mac table of VF is overflow, PF will enable promisc for this
      VF.
      
      Fixes: 1e6e7610
      
       ("net: hns3: configure promisc mode for VF asynchronously")
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      276e6042
    • Jian Shen's avatar
      net: hns3: fix show wrong state when add existing uc mac address · 108b3c78
      Jian Shen authored
      Currently, if function adds an existing unicast mac address, eventhough
      driver will not add this address into hardware, but it will return 0 in
      function hclge_add_uc_addr_common(). It will cause the state of this
      unicast mac address is ACTIVE in driver, but it should be in TO-ADD state.
      
      To fix this problem, function hclge_add_uc_addr_common() returns -EEXIST
      if mac address is existing, and delete two error log to avoid printing
      them all the time after this modification.
      
      Fixes: 72110b56
      
       ("net: hns3: return 0 and print warning when hit duplicate MAC")
      Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      108b3c78
    • Jian Shen's avatar
      net: hns3: fix mixed flag HCLGE_FLAG_MQPRIO_ENABLE and HCLGE_FLAG_DCB_ENABLE · 0472e95f
      Jian Shen authored
      HCLGE_FLAG_MQPRIO_ENABLE is supposed to set when enable
      multiple TCs with tc mqprio, and HCLGE_FLAG_DCB_ENABLE is
      supposed to set when enable multiple TCs with ets. But
      the driver mixed the flags when updating the tm configuration.
      
      Furtherly, PFC should be available when HCLGE_FLAG_MQPRIO_ENABLE
      too, so remove the unnecessary limitation.
      
      Fixes: 5a5c9091
      
       ("net: hns3: add support for tc mqprio offload")
      Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0472e95f
    • Jian Shen's avatar
      net: hns3: don't rollback when destroy mqprio fail · d82650be
      Jian Shen authored
      For destroy mqprio is irreversible in stack, so it's unnecessary
      to rollback the tc configuration when destroy mqprio failed.
      Otherwise, it may cause the configuration being inconsistent
      between driver and netstack.
      
      As the failure is usually caused by reset, and the driver will
      restore the configuration after reset, so it can keep the
      configuration being consistent between driver and hardware.
      
      Fixes: 5a5c9091
      
       ("net: hns3: add support for tc mqprio offload")
      Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d82650be
    • Jian Shen's avatar
      net: hns3: remove tc enable checking · a8e76fef
      Jian Shen authored
      Currently, in function hns3_nic_set_real_num_queue(), the
      driver doesn't report the queue count and offset for disabled
      tc. If user enables multiple TCs, but only maps user
      priorities to partial of them, it may cause the queue range
      of the unmapped TC being displayed abnormally.
      
      Fix it by removing the tc enable checking, ensure the queue
      count is not zero.
      
      With this change, the tc_en is useless now, so remove it.
      
      Fixes: a75a8efa
      
       ("net: hns3: Fix tc setup when netdev is first up")
      Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a8e76fef
    • Jian Shen's avatar
      net: hns3: do not allow call hns3_nic_net_open repeatedly · 5b09e88e
      Jian Shen authored
      hns3_nic_net_open() is not allowed to called repeatly, but there
      is no checking for this. When doing device reset and setup tc
      concurrently, there is a small oppotunity to call hns3_nic_net_open
      repeatedly, and cause kernel bug by calling napi_enable twice.
      
      The calltrace information is like below:
      [ 3078.222780] ------------[ cut here ]------------
      [ 3078.230255] kernel BUG at net/core/dev.c:6991!
      [ 3078.236224] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
      [ 3078.243431] Modules linked in: hns3 hclgevf hclge hnae3 vfio_iommu_type1 vfio_pci vfio_virqfd vfio pv680_mii(O)
      [ 3078.258880] CPU: 0 PID: 295 Comm: kworker/u8:5 Tainted: G           O      5.14.0-rc4+ #1
      [ 3078.269102] Hardware name:  , BIOS KpxxxFPGA 1P B600 V181 08/12/2021
      [ 3078.276801] Workqueue: hclge hclge_service_task [hclge]
      [ 3078.288774] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--)
      [ 3078.296168] pc : napi_enable+0x80/0x84
      tc qdisc sho[w  3d0e7v8 .e3t0h218 79] lr : hns3_nic_net_open+0x138/0x510 [hns3]
      
      [ 3078.314771] sp : ffff8000108abb20
      [ 3078.319099] x29: ffff8000108abb20 x28: 0000000000000000 x27: ffff0820a8490300
      [ 3078.329121] x26: 0000000000000001 x25: ffff08209cfc6200 x24: 0000000000000000
      [ 3078.339044] x23: ffff0820a8490300 x22: ffff08209cd76000 x21: ffff0820abfe3880
      [ 3078.349018] x20: 0000000000000000 x19: ffff08209cd76900 x18: 0000000000000000
      [ 3078.358620] x17: 0000000000000000 x16: ffffc816e1727a50 x15: 0000ffff8f4ff930
      [ 3078.368895] x14: 0000000000000000 x13: 0000000000000000 x12: 0000259e9dbeb6b4
      [ 3078.377987] x11: 0096a8f7e764eb40 x10: 634615ad28d3eab5 x9 : ffffc816ad8885b8
      [ 3078.387091] x8 : ffff08209cfc6fb8 x7 : ffff0820ac0da058 x6 : ffff0820a8490344
      [ 3078.396356] x5 : 0000000000000140 x4 : 0000000000000003 x3 : ffff08209cd76938
      [ 3078.405365] x2 : 0000000000000000 x1 : 0000000000000010 x0 : ffff0820abfe38a0
      [ 3078.414657] Call trace:
      [ 3078.418517]  napi_enable+0x80/0x84
      [ 3078.424626]  hns3_reset_notify_up_enet+0x78/0xd0 [hns3]
      [ 3078.433469]  hns3_reset_notify+0x64/0x80 [hns3]
      [ 3078.441430]  hclge_notify_client+0x68/0xb0 [hclge]
      [ 3078.450511]  hclge_reset_rebuild+0x524/0x884 [hclge]
      [ 3078.458879]  hclge_reset_service_task+0x3c4/0x680 [hclge]
      [ 3078.467470]  hclge_service_task+0xb0/0xb54 [hclge]
      [ 3078.475675]  process_one_work+0x1dc/0x48c
      [ 3078.481888]  worker_thread+0x15c/0x464
      [ 3078.487104]  kthread+0x160/0x170
      [ 3078.492479]  ret_from_fork+0x10/0x18
      [ 3078.498785] Code: c8027c81 35ffffa2 d50323bf d65f03c0 (d4210000)
      [ 3078.506889] ---[ end trace 8ebe0340a1b0fb44 ]---
      
      Once hns3_nic_net_open() is excute success, the flag
      HNS3_NIC_STATE_DOWN will be cleared. So add checking for this
      flag, directly return when HNS3_NIC_STATE_DOWN is no set.
      
      Fixes: e8884027
      
       ("net: hns3: call hns3_nic_net_open() while doing HNAE3_UP_CLIENT")
      Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5b09e88e
    • Feng Zhou's avatar
      ixgbe: Fix NULL pointer dereference in ixgbe_xdp_setup · 513e605d
      Feng Zhou authored
      The ixgbe driver currently generates a NULL pointer dereference with
      some machine (online cpus < 63). This is due to the fact that the
      maximum value of num_xdp_queues is nr_cpu_ids. Code is in
      "ixgbe_set_rss_queues"".
      
      Here's how the problem repeats itself:
      Some machine (online cpus < 63), And user set num_queues to 63 through
      ethtool. Code is in the "ixgbe_set_channels",
      	adapter->ring_feature[RING_F_FDIR].limit = count;
      
      It becomes 63.
      
      When user use xdp, "ixgbe_set_rss_queues" will set queues num.
      	adapter->num_rx_queues = rss_i;
      	adapter->num_tx_queues = rss_i;
      	adapter->num_xdp_queues = ixgbe_xdp_queues(adapter);
      
      And rss_i's value is from
      	f = &adapter->ring_feature[RING_F_FDIR];
      	rss_i = f->indices = f->limit;
      
      So "num_rx_queues" > "num_xdp_queues", when run to "ixgbe_xdp_setup",
      	for (i = 0; i < adapter->num_rx_queues; i++)
      		if (adapter->xdp_ring[i]->xsk_umem)
      
      It leads to panic.
      
      Call trace:
      [exception RIP: ixgbe_xdp+368]
      RIP: ffffffffc02a76a0  RSP: ffff9fe16202f8d0  RFLAGS: 00010297
      RAX: 0000000000000000  RBX: 0000000000000020  RCX: 0000000000000000
      RDX: 0000000000000000  RSI: 000000000000001c  RDI: ffffffffa94ead90
      RBP: ffff92f8f24c0c18   R8: 0000000000000000   R9: 0000000000000000
      R10: ffff9fe16202f830  R11: 0000000000000000  R12: ffff92f8f24c0000
      R13: ffff9fe16202fc01  R14: 000000000000000a  R15: ffffffffc02a7530
      ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
       7 [ffff9fe16202f8f0] dev_xdp_install at ffffffffa89fbbcc
       8 [ffff9fe16202f920] dev_change_xdp_fd at ffffffffa8a08808
       9 [ffff9fe16202f960] do_setlink at ffffffffa8a20235
      10 [ffff9fe16202fa88] rtnl_setlink at ffffffffa8a20384
      11 [ffff9fe16202fc78] rtnetlink_rcv_msg at ffffffffa8a1a8dd
      12 [ffff9fe16202fcf0] netlink_rcv_skb at ffffffffa8a717eb
      13 [ffff9fe16202fd40] netlink_unicast at ffffffffa8a70f88
      14 [ffff9fe16202fd80] netlink_sendmsg at ffffffffa8a71319
      15 [ffff9fe16202fdf0] sock_sendmsg at ffffffffa89df290
      16 [ffff9fe16202fe08] __sys_sendto at ffffffffa89e19c8
      17 [ffff9fe16202ff30] __x64_sys_sendto at ffffffffa89e1a64
      18 [ffff9fe16202ff38] do_syscall_64 at ffffffffa84042b9
      19 [ffff9fe16202ff50] entry_SYSCALL_64_after_hwframe at ffffffffa8c0008c
      
      So I fix ixgbe_max_channels so that it will not allow a setting of queues
      to be higher than the num_online_cpus(). And when run to ixgbe_xdp_setup,
      take the smaller value of num_rx_queues and num_xdp_queues.
      
      Fixes: 4a9b32f3
      
       ("ixgbe: fix potential RX buffer starvation for AF_XDP")
      Signed-off-by: default avatarFeng Zhou <zhoufeng.zf@bytedance.com>
      Tested-by: default avatarSandeep Penigalapati <sandeep.penigalapati@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      513e605d
    • Thomas Gleixner's avatar
      net: bridge: mcast: Associate the seqcount with its protecting lock. · f936bb42
      Thomas Gleixner authored
      The sequence count bridge_mcast_querier::seq is protected by
      net_bridge::multicast_lock but seqcount_init() does not associate the
      seqcount with the lock. This leads to a warning on PREEMPT_RT because
      preemption is still enabled.
      
      Let seqcount_init() associate the seqcount with lock that protects the
      write section. Remove lockdep_assert_held_once() because lockdep already checks
      whether the associated lock is held.
      
      Fixes: 67b746f9
      
       ("net: bridge: mcast: make sure querier port/address updates are consistent")
      Reported-by: default avatarMike Galbraith <efault@gmx.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Tested-by: default avatarMike Galbraith <efault@gmx.de>
      Acked-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Link: https://lore.kernel.org/r/20210928141049.593833-1-bigeasy@linutronix.de
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f936bb42
    • Cai Huoqing's avatar
      net: mdio-ipq4019: Fix the error for an optional regs resource · 9e28cfea
      Cai Huoqing authored
      The second resource is optional which is only provided on the chipset
      IPQ5018. But the blamed commit ignores that and if the resource is
      not there it just fails.
      
      the resource is used like this,
      	if (priv->eth_ldo_rdy) {
      		val = readl(priv->eth_ldo_rdy);
      		val |= BIT(0);
      		writel(val, priv->eth_ldo_rdy);
      		fsleep(IPQ_PHY_SET_DELAY_US);
      	}
      
      This patch reverts that to still allow the second resource to be optional
      because other SoC have the some MDIO controller and doesn't need to
      second resource.
      
      Fixes: fa14d03e
      
       ("net: mdio-ipq4019: Make use of devm_platform_ioremap_resource()")
      Signed-off-by: default avatarCai Huoqing <caihuoqing@baidu.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20210928134849.2092-1-caihuoqing@baidu.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9e28cfea
  2. Sep 28, 2021
  3. Sep 27, 2021
    • Jacob Keller's avatar
      e100: fix buffer overrun in e100_get_regs · 51032e6f
      Jacob Keller authored
      The e100_get_regs function is used to implement a simple register dump
      for the e100 device. The data is broken into a couple of MAC control
      registers, and then a series of PHY registers, followed by a memory dump
      buffer.
      
      The total length of the register dump is defined as (1 + E100_PHY_REGS)
      * sizeof(u32) + sizeof(nic->mem->dump_buf).
      
      The logic for filling in the PHY registers uses a convoluted inverted
      count for loop which counts from E100_PHY_REGS (0x1C) down to 0, and
      assigns the slots 1 + E100_PHY_REGS - i. The first loop iteration will
      fill in [1] and the final loop iteration will fill in [1 + 0x1C]. This
      is actually one more than the supposed number of PHY registers.
      
      The memory dump buffer is then filled into the space at
      [2 + E100_PHY_REGS] which will cause that memcpy to assign 4 bytes past
      the total size.
      
      The end result is that we overrun the total buffer size allocated by the
      kernel, which could lead to a panic or other issues due to memory
      corruption.
      
      It is difficult to determine the actual total number of registers
      here. The only 8255x datasheet I could find indicates there are 28 total
      MDI registers. However, we're reading 29 here, and reading them in
      reverse!
      
      In addition, the ethtool e100 register dump interface appears to read
      the first PHY register to determine if the device is in MDI or MDIx
      mode. This doesn't appear to be documented anywhere within the 8255x
      datasheet. I can only assume it must be in register 28 (the extra
      register we're reading here).
      
      Lets not change any of the intended meaning of what we copy here. Just
      extend the space by 4 bytes to account for the extra register and
      continue copying the data out in the same order.
      
      Change the E100_PHY_REGS value to be the correct total (29) so that the
      total register dump size is calculated properly. Fix the offset for
      where we copy the dump buffer so that it doesn't overrun the total size.
      
      Re-write the for loop to use counting up instead of the convoluted
      down-counting. Correct the mdio_read offset to use the 0-based register
      offsets, but maintain the bizarre reverse ordering so that we have the
      ABI expected by applications like ethtool. This requires and additional
      subtraction of 1. It seems a bit odd but it makes the flow of assignment
      into the register buffer easier to follow.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Reported-by: default avatarFelicitas Hetzelt <felicitashetzelt@gmail.com>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      51032e6f
    • Jacob Keller's avatar
      e100: fix length calculation in e100_get_regs_len · 4329c8dc
      Jacob Keller authored
      commit abf9b902 ("e100: cleanup unneeded math") tried to simplify
      e100_get_regs_len and remove a double 'divide and then multiply'
      calculation that the e100_reg_regs_len function did.
      
      This change broke the size calculation entirely as it failed to account
      for the fact that the numbered registers are actually 4 bytes wide and
      not 1 byte. This resulted in a significant under allocation of the
      register buffer used by e100_get_regs.
      
      Fix this by properly multiplying the register count by u32 first before
      adding the size of the dump buffer.
      
      Fixes: abf9b902
      
       ("e100: cleanup unneeded math")
      Reported-by: default avatarFelicitas Hetzelt <felicitashetzelt@gmail.com>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      4329c8dc
    • Xu Liang's avatar
      net: phy: enhance GPY115 loopback disable function · 3b1b6e82
      Xu Liang authored
      GPY115 need reset PHY when it comes out from loopback mode if the firmware
      version number (lower 8 bits) is equal to or below 0x76.
      
      Fixes: 7d901a1e
      
       ("net: phy: add Maxlinear GPY115/21x/24x driver")
      Signed-off-by: default avatarXu Liang <lxu@maxlinear.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3b1b6e82
    • David S. Miller's avatar
      Merge tag 'mac80211-for-net-2021-09-27' of... · ca48aa4a
      David S. Miller authored
      Merge tag 'mac80211-for-net-2021-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211
      
      
      
      Johannes berg says:
      
      ====================
      Some fixes:
       * potential use-after-free in CCMP/GCMP RX processing
       * potential use-after-free in TX A-MSDU processing
       * revert to low data rates for no-ack as the commit
         broke other things
       * limit VHT MCS/NSS in radiotap injection
       * drop frames with invalid addresses in IBSS mode
       * check rhashtable_init() return value in mesh
       * fix potentially unaligned access in mesh
       * fix late beacon hrtimer handling in hwsim (syzbot)
       * fix documentation for PTK0 rekeying
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ca48aa4a
    • David S. Miller's avatar
      Merge branch 'mv88e6xxx-mtu-fixes' · 3ebaaad4
      David S. Miller authored
      
      
      Andrew Lunn says:
      
      ====================
      mv88e6xxx: MTU fixes
      
      These three patches fix MTU issues reported by 曹煜.
      
      There are two different ways of configuring the MTU in the hardware.
      The 6161 family is using the wrong method. Some of the marvell switch
      enforce the MTU when the port is used for CPU/DSA, some don't.
      Because of the extra header, the MTU needs increasing with this
      overhead.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3ebaaad4
    • Andrew Lunn's avatar
      dsa: mv88e6xxx: Include tagger overhead when setting MTU for DSA and CPU ports · b9c587fe
      Andrew Lunn authored
      Same members of the Marvell Ethernet switches impose MTU restrictions
      on ports used for connecting to the CPU or another switch for DSA. If
      the MTU is set too low, tagged frames will be discarded. Ensure the
      worst case tagger overhead is included in setting the MTU for DSA and
      CPU ports.
      
      Fixes: 1baf0fac
      
       ("net: dsa: mv88e6xxx: Use chip-wide max frame size for MTU")
      Reported by: 曹煜 <cao88yu@gmail.com>
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b9c587fe
    • Andrew Lunn's avatar
      dsa: mv88e6xxx: Fix MTU definition · b92ce2f5
      Andrew Lunn authored
      The MTU passed to the DSA driver is the payload size, typically 1500.
      However, the switch uses the frame size when applying restrictions.
      Adjust the MTU with the size of the Ethernet header and the frame
      checksum. The VLAN header also needs to be included when the frame
      size it per port, but not when it is global.
      
      Fixes: 1baf0fac
      
       ("net: dsa: mv88e6xxx: Use chip-wide max frame size for MTU")
      Reported by: 曹煜 <cao88yu@gmail.com>
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b92ce2f5
    • Andrew Lunn's avatar
      dsa: mv88e6xxx: 6161: Use chip wide MAX MTU · fe230361
      Andrew Lunn authored
      The datasheets suggests the 6161 uses a per port setting for jumbo
      frames. Testing has however shown this is not correct, it uses the old
      style chip wide MTU control. Change the ops in the 6161 structure to
      reflect this.
      
      Fixes: 1baf0fac
      
       ("net: dsa: mv88e6xxx: Use chip-wide max frame size for MTU")
      Reported by: 曹煜 <cao88yu@gmail.com>
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fe230361
    • Yanfei Xu's avatar
      net: mdiobus: Fix memory leak in __mdiobus_register · ab609f25
      Yanfei Xu authored
      
      
      Once device_register() failed, we should call put_device() to
      decrement reference count for cleanup. Or it will cause memory
      leak.
      
      BUG: memory leak
      unreferenced object 0xffff888114032e00 (size 256):
        comm "kworker/1:3", pid 2960, jiffies 4294943572 (age 15.920s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 08 2e 03 14 81 88 ff ff  ................
          08 2e 03 14 81 88 ff ff 90 76 65 82 ff ff ff ff  .........ve.....
        backtrace:
          [<ffffffff8265cfab>] kmalloc include/linux/slab.h:591 [inline]
          [<ffffffff8265cfab>] kzalloc include/linux/slab.h:721 [inline]
          [<ffffffff8265cfab>] device_private_init drivers/base/core.c:3203 [inline]
          [<ffffffff8265cfab>] device_add+0x89b/0xdf0 drivers/base/core.c:3253
          [<ffffffff828dd643>] __mdiobus_register+0xc3/0x450 drivers/net/phy/mdio_bus.c:537
          [<ffffffff828cb835>] __devm_mdiobus_register+0x75/0xf0 drivers/net/phy/mdio_devres.c:87
          [<ffffffff82b92a00>] ax88772_init_mdio drivers/net/usb/asix_devices.c:676 [inline]
          [<ffffffff82b92a00>] ax88772_bind+0x330/0x480 drivers/net/usb/asix_devices.c:786
          [<ffffffff82baa33f>] usbnet_probe+0x3ff/0xdf0 drivers/net/usb/usbnet.c:1745
          [<ffffffff82c36e17>] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396
          [<ffffffff82661d17>] call_driver_probe drivers/base/dd.c:517 [inline]
          [<ffffffff82661d17>] really_probe.part.0+0xe7/0x380 drivers/base/dd.c:596
          [<ffffffff826620bc>] really_probe drivers/base/dd.c:558 [inline]
          [<ffffffff826620bc>] __driver_probe_device+0x10c/0x1e0 drivers/base/dd.c:751
          [<ffffffff826621ba>] driver_probe_device+0x2a/0x120 drivers/base/dd.c:781
          [<ffffffff82662a26>] __device_attach_driver+0xf6/0x140 drivers/base/dd.c:898
          [<ffffffff8265eca7>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:427
          [<ffffffff826625a2>] __device_attach+0x122/0x260 drivers/base/dd.c:969
          [<ffffffff82660916>] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:487
          [<ffffffff8265cd0b>] device_add+0x5fb/0xdf0 drivers/base/core.c:3359
          [<ffffffff82c343b9>] usb_set_configuration+0x9d9/0xb90 drivers/usb/core/message.c:2170
          [<ffffffff82c4473c>] usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:238
      
      BUG: memory leak
      unreferenced object 0xffff888116f06900 (size 32):
        comm "kworker/0:2", pid 2670, jiffies 4294944448 (age 7.160s)
        hex dump (first 32 bytes):
          75 73 62 2d 30 30 31 3a 30 30 33 00 00 00 00 00  usb-001:003.....
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<ffffffff81484516>] kstrdup+0x36/0x70 mm/util.c:60
          [<ffffffff814845a3>] kstrdup_const+0x53/0x80 mm/util.c:83
          [<ffffffff82296ba2>] kvasprintf_const+0xc2/0x110 lib/kasprintf.c:48
          [<ffffffff82358d4b>] kobject_set_name_vargs+0x3b/0xe0 lib/kobject.c:289
          [<ffffffff826575f3>] dev_set_name+0x63/0x90 drivers/base/core.c:3147
          [<ffffffff828dd63b>] __mdiobus_register+0xbb/0x450 drivers/net/phy/mdio_bus.c:535
          [<ffffffff828cb835>] __devm_mdiobus_register+0x75/0xf0 drivers/net/phy/mdio_devres.c:87
          [<ffffffff82b92a00>] ax88772_init_mdio drivers/net/usb/asix_devices.c:676 [inline]
          [<ffffffff82b92a00>] ax88772_bind+0x330/0x480 drivers/net/usb/asix_devices.c:786
          [<ffffffff82baa33f>] usbnet_probe+0x3ff/0xdf0 drivers/net/usb/usbnet.c:1745
          [<ffffffff82c36e17>] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396
          [<ffffffff82661d17>] call_driver_probe drivers/base/dd.c:517 [inline]
          [<ffffffff82661d17>] really_probe.part.0+0xe7/0x380 drivers/base/dd.c:596
          [<ffffffff826620bc>] really_probe drivers/base/dd.c:558 [inline]
          [<ffffffff826620bc>] __driver_probe_device+0x10c/0x1e0 drivers/base/dd.c:751
          [<ffffffff826621ba>] driver_probe_device+0x2a/0x120 drivers/base/dd.c:781
          [<ffffffff82662a26>] __device_attach_driver+0xf6/0x140 drivers/base/dd.c:898
          [<ffffffff8265eca7>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:427
          [<ffffffff826625a2>] __device_attach+0x122/0x260 drivers/base/dd.c:969
      
      Reported-by: default avatar <syzbot+398e7dc692ddbbb4cfec@syzkaller.appspotmail.com>
      Signed-off-by: default avatarYanfei Xu <yanfei.xu@windriver.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ab609f25