Skip to content
  1. Aug 26, 2021
  2. Aug 25, 2021
    • Davide Caratti's avatar
      net/sched: ets: fix crash when flipping from 'strict' to 'quantum' · cd9b50ad
      Davide Caratti authored
      
      
      While running kselftests, Hangbin observed that sch_ets.sh often crashes,
      and splats like the following one are seen in the output of 'dmesg':
      
       BUG: kernel NULL pointer dereference, address: 0000000000000000
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 159f12067 P4D 159f12067 PUD 159f13067 PMD 0
       Oops: 0000 [#1] SMP NOPTI
       CPU: 2 PID: 921 Comm: tc Not tainted 5.14.0-rc6+ #458
       Hardware name: Red Hat KVM, BIOS 1.11.1-4.module+el8.1.0+4066+0f1aadab 04/01/2014
       RIP: 0010:__list_del_entry_valid+0x2d/0x50
       Code: 48 8b 57 08 48 b9 00 01 00 00 00 00 ad de 48 39 c8 0f 84 ac 6e 5b 00 48 b9 22 01 00 00 00 00 ad de 48 39 ca 0f 84 cf 6e 5b 00 <48> 8b 32 48 39 fe 0f 85 af 6e 5b 00 48 8b 50 08 48 39 f2 0f 85 94
       RSP: 0018:ffffb2da005c3890 EFLAGS: 00010217
       RAX: 0000000000000000 RBX: ffff9073ba23f800 RCX: dead000000000122
       RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff9073ba23fbc8
       RBP: ffff9073ba23f890 R08: 0000000000000001 R09: 0000000000000001
       R10: 0000000000000001 R11: 0000000000000001 R12: dead000000000100
       R13: ffff9073ba23fb00 R14: 0000000000000002 R15: 0000000000000002
       FS:  00007f93e5564e40(0000) GS:ffff9073bba00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000000 CR3: 000000014ad34000 CR4: 0000000000350ee0
       Call Trace:
        ets_qdisc_reset+0x6e/0x100 [sch_ets]
        qdisc_reset+0x49/0x1d0
        tbf_reset+0x15/0x60 [sch_tbf]
        qdisc_reset+0x49/0x1d0
        dev_reset_queue.constprop.42+0x2f/0x90
        dev_deactivate_many+0x1d3/0x3d0
        dev_deactivate+0x56/0x90
        qdisc_graft+0x47e/0x5a0
        tc_get_qdisc+0x1db/0x3e0
        rtnetlink_rcv_msg+0x164/0x4c0
        netlink_rcv_skb+0x50/0x100
        netlink_unicast+0x1a5/0x280
        netlink_sendmsg+0x242/0x480
        sock_sendmsg+0x5b/0x60
        ____sys_sendmsg+0x1f2/0x260
        ___sys_sendmsg+0x7c/0xc0
        __sys_sendmsg+0x57/0xa0
        do_syscall_64+0x3a/0x80
        entry_SYSCALL_64_after_hwframe+0x44/0xae
       RIP: 0033:0x7f93e44b8338
       Code: 89 02 48 c7 c0 ff ff ff ff eb b5 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 25 43 2c 00 8b 00 85 c0 75 17 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 41 89 d4 55
       RSP: 002b:00007ffc0db737a8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
       RAX: ffffffffffffffda RBX: 0000000061255c06 RCX: 00007f93e44b8338
       RDX: 0000000000000000 RSI: 00007ffc0db73810 RDI: 0000000000000003
       RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
       R10: 000000000000000b R11: 0000000000000246 R12: 0000000000000001
       R13: 0000000000687880 R14: 0000000000000000 R15: 0000000000000000
       Modules linked in: sch_ets sch_tbf dummy rfkill iTCO_wdt iTCO_vendor_support intel_rapl_msr intel_rapl_common joydev i2c_i801 pcspkr i2c_smbus lpc_ich virtio_balloon ip_tables xfs libcrc32c crct10dif_pclmul crc32_pclmul crc32c_intel ahci libahci ghash_clmulni_intel libata serio_raw virtio_blk virtio_console virtio_net net_failover failover sunrpc dm_mirror dm_region_hash dm_log dm_mod
       CR2: 0000000000000000
      
      When the change() function decreases the value of 'nstrict', we must take
      into account that packets might be already enqueued on a class that flips
      from 'strict' to 'quantum': otherwise that class will not be added to the
      bandwidth-sharing list. Then, a call to ets_qdisc_reset() will attempt to
      do list_del(&alist) with 'alist' filled with zero, hence the NULL pointer
      dereference.
      For classes flipping from 'strict' to 'quantum', initialize an empty list
      and eventually add it to the bandwidth-sharing list, if there are packets
      already enqueued. In this way, the kernel will:
       a) prevent crashing as described above.
       b) avoid retaining the backlog packets (for an arbitrarily long time) in
          case no packet is enqueued after a change from 'strict' to 'quantum'.
      
      Reported-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Fixes: dcc68b4d
      
       ("net: sch_ets: Add a new Qdisc")
      Signed-off-by: default avatarDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cd9b50ad
    • Shai Malin's avatar
      qede: Fix memset corruption · e5434688
      Shai Malin authored
      
      
      Thanks to Kees Cook who detected the problem of memset that starting
      from not the first member, but sized for the whole struct.
      The better change will be to remove the redundant memset and to clear
      only the msix_cnt member.
      
      Signed-off-by: default avatarPrabhakar Kushwaha <pkushwaha@marvell.com>
      Signed-off-by: default avatarAriel Elior <aelior@marvell.com>
      Signed-off-by: default avatarShai Malin <smalin@marvell.com>
      Reported-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e5434688
    • Song Yoong Siang's avatar
      net: stmmac: fix kernel panic due to NULL pointer dereference of buf->xdp · 2b9fff64
      Song Yoong Siang authored
      Ensure a valid XSK buffer before proceed to free the xdp buffer.
      
      The following kernel panic is observed without this patch:
      
      RIP: 0010:xp_free+0x5/0x40
      Call Trace:
      stmmac_napi_poll_rxtx+0x332/0xb30 [stmmac]
      ? stmmac_tx_timer+0x3c/0xb0 [stmmac]
      net_rx_action+0x13d/0x3d0
      __do_softirq+0xfc/0x2fb
      ? smpboot_register_percpu_thread+0xe0/0xe0
      run_ksoftirqd+0x32/0x70
      smpboot_thread_fn+0x1d8/0x2c0
      kthread+0x169/0x1a0
      ? kthread_park+0x90/0x90
      ret_from_fork+0x1f/0x30
      ---[ end trace 0000000000000002 ]---
      
      Fixes: bba2556e
      
       ("net: stmmac: Enable RX via AF_XDP zero-copy")
      Cc: <stable@vger.kernel.org> # 5.13.x
      Suggested-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: default avatarSong Yoong Siang <yoong.siang.song@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2b9fff64
    • Song Yoong Siang's avatar
      net: stmmac: fix kernel panic due to NULL pointer dereference of xsk_pool · a6451192
      Song Yoong Siang authored
      After free xsk_pool, there is possibility that napi polling is still
      running in the middle, thus causes a kernel crash due to kernel NULL
      pointer dereference of rx_q->xsk_pool and tx_q->xsk_pool.
      
      Fix this by changing the XDP pool setup sequence to:
       1. disable napi before free xsk_pool
       2. enable napi after init xsk_pool
      
      The following kernel panic is observed without this patch:
      
      RIP: 0010:xsk_uses_need_wakeup+0x5/0x10
      Call Trace:
      stmmac_napi_poll_rxtx+0x3a9/0xae0 [stmmac]
      __napi_poll+0x27/0x130
      net_rx_action+0x233/0x280
      __do_softirq+0xe2/0x2b6
      run_ksoftirqd+0x1a/0x20
      smpboot_thread_fn+0xac/0x140
      ? sort_range+0x20/0x20
      kthread+0x124/0x150
      ? set_kthread_struct+0x40/0x40
      ret_from_fork+0x1f/0x30
      ---[ end trace a77c8956b79ac107 ]---
      
      Fixes: bba2556e
      
       ("net: stmmac: Enable RX via AF_XDP zero-copy")
      Cc: <stable@vger.kernel.org> # 5.13.x
      Signed-off-by: default avatarSong Yoong Siang <yoong.siang.song@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a6451192
    • Harini Katakam's avatar
      net: macb: Add a NULL check on desc_ptp · 85520079
      Harini Katakam authored
      
      
      macb_ptp_desc will not return NULL under most circumstances with correct
      Kconfig and IP design config register. But for the sake of the extreme
      corner case, check for NULL when using the helper. In case of rx_tstamp,
      no action is necessary except to return (similar to timestamp disabled)
      and warn. In case of TX, return -EINVAL to let the skb be free. Perform
      this check before marking skb in progress.
      Fixes coverity warning:
      (4) Event dereference:
      Dereferencing a null pointer "desc_ptp"
      
      Signed-off-by: default avatarHarini Katakam <harini.katakam@xilinx.com>
      Reviewed-by: default avatarRadhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
      Signed-off-by: default avatarMichal Simek <michal.simek@xilinx.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      85520079
    • Michael Riesch's avatar
      net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings · 2d26f6e3
      Michael Riesch authored
      This reverts commit 2c896fb0
      "net: stmmac: dwmac-rk: add pd_gmac support for rk3399" and fixes
      unbalanced pm_runtime_enable warnings.
      
      In the commit to be reverted, support for power management was
      introduced to the Rockchip glue code. Later, power management support
      was introduced to the stmmac core code, resulting in multiple
      invocations of pm_runtime_{enable,disable,get_sync,put_sync}.
      
      The multiple invocations happen in rk_gmac_powerup and
      stmmac_{dvr_probe, resume} as well as in rk_gmac_powerdown and
      stmmac_{dvr_remove, suspend}, respectively, which are always called
      in conjunction.
      
      Fixes: 5ec55823
      
       ("net: stmmac: add clocks management for gmac driver")
      Signed-off-by: default avatarMichael Riesch <michael.riesch@wolfvision.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2d26f6e3
    • DENG Qingfang's avatar
      net: phy: mediatek: add the missing suspend/resume callbacks · 93100d68
      DENG Qingfang authored
      Without suspend/resume callbacks, the PHY cannot be powered down/up
      administratively.
      
      Fixes: e40d2cca
      
       ("net: phy: add MediaTek Gigabit Ethernet PHY driver")
      Signed-off-by: default avatarDENG Qingfang <dqfext@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20210823044422.164184-1-dqfext@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      93100d68
  3. Aug 24, 2021
  4. Aug 23, 2021
    • David S. Miller's avatar
      Merge branch 'asix-fixes' · 14315498
      David S. Miller authored
      
      
      Oleksij Rempel says:
      
      ====================
      asix fixes
      
      changes v2:
      - rebase against current net
      - add one more fix for the ax88178 variant
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      14315498
    • Oleksij Rempel's avatar
      net: usb: asix: do not call phy_disconnect() for ax88178 · 1406e8cb
      Oleksij Rempel authored
      Fix crash on reboot on a system with ASIX AX88178 USB adapter attached
      to it:
      | asix 1-1.4:1.0 eth0: unregister 'asix' usb-ci_hdrc.0-1.4, ASIX AX88178 USB 2.0 Ethernet
      | 8<--- cut here ---
      | Unable to handle kernel NULL pointer dereference at virtual address 0000028c
      | pgd = 5ec93aee
      | [0000028c] *pgd=00000000
      | Internal error: Oops: 5 [#1] PREEMPT SMP ARM
      | Modules linked in:
      | CPU: 1 PID: 1 Comm: systemd-shutdow Not tainted 5.14.0-rc1-20210811-1 #4
      | Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
      | PC is at phy_disconnect+0x8/0x48
      | LR is at ax88772_unbind+0x14/0x20
      | [<80650d04>] (phy_disconnect) from [<80741aa4>] (ax88772_unbind+0x14/0x20)
      | [<80741aa4>] (ax88772_unbind) from [<8074e250>] (usbnet_disconnect+0x48/0xd8)
      | [<8074e250>] (usbnet_disconnect) from [<807655e0>] (usb_unbind_interface+0x78/0x25c)
      | [<807655e0>] (usb_unbind_interface) from [<805b03a0>] (__device_release_driver+0x154/0x20c)
      | [<805b03a0>] (__device_release_driver) from [<805b0478>] (device_release_driver+0x20/0x2c)
      | [<805b0478>] (device_release_driver) from [<805af944>] (bus_remove_device+0xcc/0xf8)
      | [<805af944>] (bus_remove_device) from [<805ab26c>] (device_del+0x178/0x4b0)
      | [<805ab26c>] (device_del) from [<807634a4>] (usb_disable_device+0xcc/0x178)
      | [<807634a4>] (usb_disable_device) from [<8075a060>] (usb_disconnect+0xd8/0x238)
      | [<8075a060>] (usb_disconnect) from [<8075a02c>] (usb_disconnect+0xa4/0x238)
      | [<8075a02c>] (usb_disconnect) from [<8075a02c>] (usb_disconnect+0xa4/0x238)
      | [<8075a02c>] (usb_disconnect) from [<80af3520>] (usb_remove_hcd+0xa0/0x198)
      | [<80af3520>] (usb_remove_hcd) from [<807902e0>] (host_stop+0x38/0xa8)
      | [<807902e0>] (host_stop) from [<8078d9e4>] (ci_hdrc_remove+0x3c/0x118)
      | [<8078d9e4>] (ci_hdrc_remove) from [<805b27ec>] (platform_remove+0x20/0x50)
      | [<805b27ec>] (platform_remove) from [<805b03a0>] (__device_release_driver+0x154/0x20c)
      | [<805b03a0>] (__device_release_driver) from [<805b0478>] (device_release_driver+0x20/0x2c)
      | [<805b0478>] (device_release_driver) from [<805af944>] (bus_remove_device+0xcc/0xf8)
      | [<805af944>] (bus_remove_device) from [<805ab26c>] (device_del+0x178/0x4b0)
      
      For this adapter we call ax88178_bind() and ax88772_unbind(), which is
      related to different chip version and different counter part *bind()
      function.
      
      Since this chip is currently not ported to the PHYLIB, we do not need to
      call phy_disconnect() here. So, to fix this crash, we need to add
      ax88178_unbind().
      
      Fixes: e532a096
      
       ("net: usb: asix: ax88772: add phylib support")
      Reported-by: default avatarRobin van der Gracht <robin@protonic.nl>
      Tested-by: default avatarRobin van der Gracht <robin@protonic.nl>
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1406e8cb
    • Oleksij Rempel's avatar
      net: usb: asix: ax88772: move embedded PHY detection as early as possible · 7a141e64
      Oleksij Rempel authored
      Some HW revisions need additional MAC configuration before the embedded PHY
      can be enabled. If this is not done, we won't be able to get response
      from the internal PHY.
      
      This issue was detected on chipcode == AX_AX88772_CHIPCODE variant,
      where ax88772_hw_reset() was executed with missing embd_phy flag.
      
      Fixes: e532a096
      
       ("net: usb: asix: ax88772: add phylib support")
      Reported-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
      Tested-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7a141e64
    • Maxim Kiselev's avatar
      net: marvell: fix MVNETA_TX_IN_PRGRS bit number · 359f4cdd
      Maxim Kiselev authored
      According to Armada XP datasheet bit at 0 position is corresponding for
      TxInProg indication.
      
      Fixes: c5aff182
      
       ("net: mvneta: driver for Marvell Armada 370/XP network unit")
      Signed-off-by: default avatarMaxim Kiselev <bigunclemax@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      359f4cdd
    • Wong Vee Khee's avatar
      net: stmmac: fix kernel panic due to NULL pointer dereference of plat->est · 82a44ae1
      Wong Vee Khee authored
      In the case of taprio offload is not enabled, the error handling path
      causes a kernel crash due to kernel NULL pointer deference.
      
      Fix this by adding check for NULL before attempt to access 'plat->est'
      on the mutex_lock() call.
      
      The following kernel panic is observed without this patch:
      
      RIP: 0010:mutex_lock+0x10/0x20
      Call Trace:
      tc_setup_taprio+0x482/0x560 [stmmac]
      kmem_cache_alloc_trace+0x13f/0x490
      taprio_disable_offload.isra.0+0x9d/0x180 [sch_taprio]
      taprio_destroy+0x6c/0x100 [sch_taprio]
      qdisc_create+0x2e5/0x4f0
      tc_modify_qdisc+0x126/0x740
      rtnetlink_rcv_msg+0x12b/0x380
      _raw_spin_lock_irqsave+0x19/0x40
      _raw_spin_unlock_irqrestore+0x18/0x30
      create_object+0x212/0x340
      rtnl_calcit.isra.0+0x110/0x110
      netlink_rcv_skb+0x50/0x100
      netlink_unicast+0x191/0x230
      netlink_sendmsg+0x243/0x470
      sock_sendmsg+0x5e/0x60
      ____sys_sendmsg+0x20b/0x280
      copy_msghdr_from_user+0x5c/0x90
      __mod_memcg_state+0x87/0xf0
       ___sys_sendmsg+0x7c/0xc0
      lru_cache_add+0x7f/0xa0
      _raw_spin_unlock+0x16/0x30
      wp_page_copy+0x449/0x890
      handle_mm_fault+0x921/0xfc0
      __sys_sendmsg+0x59/0xa0
      do_syscall_64+0x33/0x40
      entry_SYSCALL_64_after_hwframe+0x44/0xa9
      ---[ end trace b1f19b24368a96aa ]---
      
      Fixes: b60189e0
      
       ("net: stmmac: Integrate EST with TAPRIO scheduler API")
      Cc: <stable@vger.kernel.org> # 5.10.x
      Signed-off-by: default avatarWong Vee Khee <vee.khee.wong@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      82a44ae1
    • David S. Miller's avatar
      Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue · 46002bf3
      David S. Miller authored
      
      
      Tony Nguyen says:
      
      ====================
      Intel Wired LAN Driver Updates 2021-08-20
      
      This series contains updates to igc and e1000e drivers.
      
      Aaron Ma resolves a page fault which occurs when thunderbolt is
      unplugged for igc.
      
      Toshiki Nishioka fixes Tx queue looping to use actual number of queues
      instead of max value for igc.
      
      Sasha fixes an incorrect latency comparison by decoding the values before
      comparing and prevents attempted writes to read-only NVMs for e1000e.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      46002bf3
    • Christophe JAILLET's avatar
      xgene-v2: Fix a resource leak in the error handling path of 'xge_probe()' · 5ed74b03
      Christophe JAILLET authored
      A successful 'xge_mdio_config()' call should be balanced by a corresponding
      'xge_mdio_remove()' call in the error handling path of the probe, as
      already done in the remove function.
      
      Update the error handling path accordingly.
      
      Fixes: ea8ab16a
      
       ("drivers: net: xgene-v2: Add MDIO support")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5ed74b03
    • Shreyansh Chouhan's avatar
      ip6_gre: add validation for csum_start · 9cf448c2
      Shreyansh Chouhan authored
      Validate csum_start in gre_handle_offloads before we call _gre_xmit so
      that we do not crash later when the csum_start value is used in the
      lco_csum function call.
      
      This patch deals with ipv6 code.
      
      Fixes: Fixes: b05229f4
      
       ("gre6: Cleanup GREv6 transmit path, call common
      GRE functions")
      Reported-by: default avatar <syzbot+ff8e1b9f2f36481e2efc@syzkaller.appspotmail.com>
      Signed-off-by: default avatarShreyansh Chouhan <chouhan.shreyansh630@gmail.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9cf448c2
    • Shreyansh Chouhan's avatar
      ip_gre: add validation for csum_start · 1d011c48
      Shreyansh Chouhan authored
      Validate csum_start in gre_handle_offloads before we call _gre_xmit so
      that we do not crash later when the csum_start value is used in the
      lco_csum function call.
      
      This patch deals with ipv4 code.
      
      Fixes: c5441932
      
       ("GRE: Refactor GRE tunneling code.")
      Reported-by: default avatar <syzbot+ff8e1b9f2f36481e2efc@syzkaller.appspotmail.com>
      Signed-off-by: default avatarShreyansh Chouhan <chouhan.shreyansh630@gmail.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1d011c48
  5. Aug 21, 2021
    • Marc Zyngier's avatar
      stmmac: Revert "stmmac: align RX buffers" · 12d125b4
      Marc Zyngier authored
      This reverts commit a955318f ("stmmac: align RX buffers"),
      which breaks at least one platform (Nvidia Jetson-X1), causing
      packet corruption. This is 100% reproducible, and reverting
      the patch results in a working system again.
      
      Given that it is "only" a performance optimisation, let's
      return to a known working configuration until we can have a
      good understanding of what is happening here.
      
      Fixes: a955318f
      
       ("stmmac: align RX buffers")
      Cc: Matteo Croce <mcroce@linux.microsoft.com>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
      Link: https://lore.kernel.org/netdev/871r71azjw.wl-maz@kernel.org
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20210820183002.457226-1-maz@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      12d125b4
  6. Aug 20, 2021
    • Sasha Neftin's avatar
      e1000e: Do not take care about recovery NVM checksum · 4051f683
      Sasha Neftin authored
      On new platforms, the NVM is read-only. Attempting to update the NVM
      is causing a lockup to occur. Do not attempt to write to the NVM
      on platforms where it's not supported.
      Emit an error message when the NVM checksum is invalid.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=213667
      Fixes: fb776f5d
      
       ("e1000e: Add support for Tiger Lake")
      Suggested-by: default avatarDima Ruinskiy <dima.ruinskiy@intel.com>
      Suggested-by: default avatarVitaly Lifshits <vitaly.lifshits@intel.com>
      Signed-off-by: default avatarSasha Neftin <sasha.neftin@intel.com>
      Tested-by: default avatarDvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      4051f683
    • Sasha Neftin's avatar
      e1000e: Fix the max snoop/no-snoop latency for 10M · 44a13a5d
      Sasha Neftin authored
      We should decode the latency and the max_latency before directly compare.
      The latency should be presented as lat_enc = scale x value:
      lat_enc_d = (lat_enc & 0x0x3ff) x (1U << (5*((max_ltr_enc & 0x1c00)
      >> 10)))
      
      Fixes: cf8fb73c
      
       ("e1000e: add support for LTR on I217/I218")
      Suggested-by: default avatarYee Li <seven.yi.lee@gmail.com>
      Signed-off-by: default avatarSasha Neftin <sasha.neftin@intel.com>
      Tested-by: default avatarDvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      44a13a5d
    • Toshiki Nishioka's avatar
      igc: Use num_tx_queues when iterating over tx_ring queue · 691bd4d7
      Toshiki Nishioka authored
      Use num_tx_queues rather than the IGC_MAX_TX_QUEUES fixed number 4 when
      iterating over tx_ring queue since instantiated queue count could be
      less than 4 where on-line cpu count is less than 4.
      
      Fixes: ec50a9d4
      
       ("igc: Add support for taprio offloading")
      Signed-off-by: default avatarToshiki Nishioka <toshiki.nishioka@intel.com>
      Signed-off-by: default avatarMuhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
      Tested-by: default avatarMuhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
      Acked-by: default avatarSasha Neftin <sasha.neftin@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      691bd4d7
    • Aaron Ma's avatar
      igc: fix page fault when thunderbolt is unplugged · 4b799595
      Aaron Ma authored
      After unplug thunderbolt dock with i225, pciehp interrupt is triggered,
      remove call will read/write mmio address which is already disconnected,
      then cause page fault and make system hang.
      
      Check PCI state to remove device safely.
      
      Trace:
      BUG: unable to handle page fault for address: 000000000000b604
      Oops: 0000 [#1] SMP NOPTI
      RIP: 0010:igc_rd32+0x1c/0x90 [igc]
      Call Trace:
      igc_ptp_suspend+0x6c/0xa0 [igc]
      igc_ptp_stop+0x12/0x50 [igc]
      igc_remove+0x7f/0x1c0 [igc]
      pci_device_remove+0x3e/0xb0
      __device_release_driver+0x181/0x240
      
      Fixes: 13b5b7fd ("igc: Add support for Tx/Rx rings")
      Fixes: b03c49cd
      
       ("igc: Save PTP time before a reset")
      Signed-off-by: default avatarAaron Ma <aaron.ma@canonical.com>
      Tested-by: default avatarDvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      4b799595
    • Petko Manolov's avatar
      net: usb: pegasus: fixes of set_register(s) return value evaluation; · ffc9c3eb
      Petko Manolov authored
      - restore the behavior in enable_net_traffic() to avoid regressions - Jakub
          Kicinski;
        - hurried up and removed redundant assignment in pegasus_open() before yet
          another checker complains;
      
      Fixes: 8a160e2e
      
       ("net: usb: pegasus: Check the return value of get_geristers() and friends;")
      Reported-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarPetko Manolov <petko.manolov@konsulko.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ffc9c3eb
    • Xiaolong Huang's avatar
      net: qrtr: fix another OOB Read in qrtr_endpoint_post · 7e78c597
      Xiaolong Huang authored
      This check was incomplete, did not consider size is 0:
      
      	if (len != ALIGN(size, 4) + hdrlen)
                          goto err;
      
      if size from qrtr_hdr is 0, the result of ALIGN(size, 4)
      will be 0, In case of len == hdrlen and size == 0
      in header this check won't fail and
      
      	if (cb->type == QRTR_TYPE_NEW_SERVER) {
                      /* Remote node endpoint can bridge other distant nodes */
                      const struct qrtr_ctrl_pkt *pkt = data + hdrlen;
      
                      qrtr_node_assign(node, le32_to_cpu(pkt->server.node));
              }
      
      will also read out of bound from data, which is hdrlen allocated block.
      
      Fixes: 194ccc88 ("net: qrtr: Support decoding incoming v2 packets")
      Fixes: ad9d24c9
      
       ("net: qrtr: fix OOB Read in qrtr_endpoint_post")
      Signed-off-by: default avatarXiaolong Huang <butterflyhuangxx@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7e78c597
    • Jacob Keller's avatar
      ice: do not abort devlink info if board identifier can't be found · a8f89fa2
      Jacob Keller authored
      The devlink dev info command reports version information about the
      device and firmware running on the board. This includes the "board.id"
      field which is supposed to represent an identifier of the board design.
      The ice driver uses the Product Board Assembly identifier for this.
      
      In some cases, the PBA is not present in the NVM. If this happens,
      devlink dev info will fail with an error. Instead, modify the
      ice_info_pba function to just exit without filling in the context
      buffer. This will cause the board.id field to be skipped. Log a dev_dbg
      message in case someone wants to confirm why board.id is not showing up
      for them.
      
      Fixes: e961b679
      
       ("ice: add board identifier info to devlink .info_get")
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Link: https://lore.kernel.org/r/20210819223451.245613-1-anthony.l.nguyen@intel.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a8f89fa2
    • Linus Torvalds's avatar
      Merge tag 'net-5.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · f87d6431
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Networking fixes, including fixes from bpf, wireless and mac80211
        trees.
      
        Current release - regressions:
      
         - tipc: call tipc_wait_for_connect only when dlen is not 0
      
         - mac80211: fix locking in ieee80211_restart_work()
      
        Current release - new code bugs:
      
         - bpf: add rcu_read_lock in bpf_get_current_[ancestor_]cgroup_id()
      
         - ethernet: ice: fix perout start time rounding
      
         - wwan: iosm: prevent underflow in ipc_chnl_cfg_get()
      
        Previous releases - regressions:
      
         - bpf: clear zext_dst of dead insns
      
         - sch_cake: fix srchost/dsthost hashing mode
      
         - vrf: reset skb conntrack connection on VRF rcv
      
         - net/rds: dma_map_sg is entitled to merge entries
      
        Previous releases - always broken:
      
         - ethernet: bnxt: fix Tx path locking and races, add Rx path
           barriers"
      
      * tag 'net-5.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (42 commits)
        net: dpaa2-switch: disable the control interface on error path
        Revert "flow_offload: action should not be NULL when it is referenced"
        iavf: Fix ping is lost after untrusted VF had tried to change MAC
        i40e: Fix ATR queue selection
        r8152: fix the maximum number of PLA bp for RTL8153C
        r8152: fix writing USB_BP2_EN
        mptcp: full fully established support after ADD_ADDR
        mptcp: fix memory leak on address flush
        net/rds: dma_map_sg is entitled to merge entries
        net: mscc: ocelot: allow forwarding from bridge ports to the tag_8021q CPU port
        net: asix: fix uninit value bugs
        ovs: clear skb->tstamp in forwarding path
        net: mdio-mux: Handle -EPROBE_DEFER correctly
        net: mdio-mux: Don't ignore memory allocation errors
        net: mdio-mux: Delete unnecessary devm_kfree
        net: dsa: sja1105: fix use-after-free after calling of_find_compatible_node, or worse
        sch_cake: fix srchost/dsthost hashing mode
        ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path
        net: qlcnic: add missed unlock in qlcnic_83xx_flash_read32
        mac80211: fix locking in ieee80211_restart_work()
        ...
      f87d6431
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v5.14-4' of... · e649e4c8
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v5.14-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
      
      Pull x86 platform driver fixes from Hans de Goede:
      
       - Enable SW_TABLET_MODE support for the TP200s
      
       - Enable WMI on two more Gigabyte motherboards
      
      * tag 'platform-drivers-x86-v5.14-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
        platform/x86: gigabyte-wmi: add support for B450M S2H V2
        platform/x86: gigabyte-wmi: add support for X570 GAMING X
        platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s
        platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option
      e649e4c8
    • Vladimir Oltean's avatar
      net: dpaa2-switch: disable the control interface on error path · cd0a719f
      Vladimir Oltean authored
      Currently dpaa2_switch_takedown has a funny name and does not do the
      opposite of dpaa2_switch_init, which makes probing fail when we need to
      handle an -EPROBE_DEFER.
      
      A sketch of what dpaa2_switch_init does:
      
      	dpsw_open
      
      	dpaa2_switch_detect_features
      
      	dpsw_reset
      
      	for (i = 0; i < ethsw->sw_attr.num_ifs; i++) {
      		dpsw_if_disable
      
      		dpsw_if_set_stp
      
      		dpsw_vlan_remove_if_untagged
      
      		dpsw_if_set_tci
      
      		dpsw_vlan_remove_if
      	}
      
      	dpsw_vlan_remove
      
      	alloc_ordered_workqueue
      
      	dpsw_fdb_remove
      
      	dpaa2_switch_ctrl_if_setup
      
      When dpaa2_switch_takedown is called from the error path of
      dpaa2_switch_probe(), the control interface, enabled by
      dpaa2_switch_ctrl_if_setup from dpaa2_switch_init, remains enabled,
      because dpaa2_switch_takedown does not call
      dpaa2_switch_ctrl_if_teardown.
      
      Since dpaa2_switch_probe might fail due to EPROBE_DEFER of a PHY, this
      means that a second probe of the driver will happen with the control
      interface directly enabled.
      
      This will trigger a second error:
      
      [   93.273528] fsl_dpaa2_switch dpsw.0: dpsw_ctrl_if_set_pools() failed
      [   93.281966] fsl_dpaa2_switch dpsw.0: fsl_mc_driver_probe failed: -13
      [   93.288323] fsl_dpaa2_switch: probe of dpsw.0 failed with error -13
      
      Which if we investigate the /dev/dpaa2_mc_console log, we find out is
      caused by:
      
      [E, ctrl_if_set_pools:2211, DPMNG]  ctrl_if must be disabled
      
      So make dpaa2_switch_takedown do the opposite of dpaa2_switch_init (in
      reasonable limits, no reason to change STP state, re-add VLANs etc), and
      rename it to something more conventional, like dpaa2_switch_teardown.
      
      Fixes: 613c0a58
      
       ("staging: dpaa2-switch: enable the control interface")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Link: https://lore.kernel.org/r/20210819141755.1931423-1-vladimir.oltean@nxp.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cd0a719f
    • Ido Schimmel's avatar
      Revert "flow_offload: action should not be NULL when it is referenced" · fa05bdb8
      Ido Schimmel authored
      This reverts commit 9ea3e52c.
      
      Cited commit added a check to make sure 'action' is not NULL, but
      'action' is already dereferenced before the check, when calling
      flow_offload_has_one_action().
      
      Therefore, the check does not make any sense and results in a smatch
      warning:
      
      include/net/flow_offload.h:322 flow_action_mixed_hw_stats_check() warn:
      variable dereferenced before check 'action' (see line 319)
      
      Fix by reverting this commit.
      
      Cc: gushengxian <gushengxian@yulong.com>
      Fixes: 9ea3e52c
      
       ("flow_offload: action should not be NULL when it is referenced")
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Link: https://lore.kernel.org/r/20210819105842.1315705-1-idosch@idosch.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      fa05bdb8
    • Jakub Kicinski's avatar
      Merge branch 'intel-wired-lan-driver-updates-2021-08-18' · d584566c
      Jakub Kicinski authored
      
      
      Tony Nguyen says:
      
      ====================
      Intel Wired LAN Driver Updates 2021-08-18
      
      This series contains updates to i40e and iavf drivers.
      
      Arkadiusz fixes Flow Director not using the correct queue due to calling
      the wrong pick Tx function for i40e.
      
      Sylwester resolves traffic loss for iavf when it attempts to change its
      MAC address when it does not have permissions to do so.
      ====================
      
      Link: https://lore.kernel.org/r/20210818174217.4138922-1-anthony.l.nguyen@intel.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d584566c
    • Sylwester Dziedziuch's avatar
      iavf: Fix ping is lost after untrusted VF had tried to change MAC · 8da80c9d
      Sylwester Dziedziuch authored
      Make changes to MAC address dependent on the response of PF.
      Disallow changes to HW MAC address and MAC filter from untrusted
      VF, thanks to that ping is not lost if VF tries to change MAC.
      Add a new field in iavf_mac_filter, to indicate whether there
      was response from PF for given filter. Based on this field pass
      or discard the filter.
      If untrusted VF tried to change it's address, it's not changed.
      Still filter was changed, because of that ping couldn't go through.
      
      Fixes: c5c922b3
      
       ("iavf: fix MAC address setting for VFs when filter is rejected")
      Signed-off-by: default avatarPrzemyslaw Patynowski <przemyslawx.patynowski@intel.com>
      Signed-off-by: default avatarSylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
      Signed-off-by: default avatarMateusz Palczewski <mateusz.palczewski@intel.com>
      Tested-by: default avatarGurucharan G <Gurucharanx.g@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8da80c9d
    • Arkadiusz Kubalewski's avatar
      i40e: Fix ATR queue selection · a222be59
      Arkadiusz Kubalewski authored
      Without this patch, ATR does not work. Receive/transmit uses queue
      selection based on SW DCB hashing method.
      
      If traffic classes are not configured for PF, then use
      netdev_pick_tx function for selecting queue for packet transmission.
      Instead of calling i40e_swdcb_skb_tx_hash, call netdev_pick_tx,
      which ensures that packet is transmitted/received from CPU that is
      running the application.
      
      Reproduction steps:
      1. Load i40e driver
      2. Map each MSI interrupt of i40e port for each CPU
      3. Disable ntuple, enable ATR i.e.:
      ethtool -K $interface ntuple off
      ethtool --set-priv-flags $interface flow-director-atr
      4. Run application that is generating traffic and is bound to a
      single CPU, i.e.:
      taskset -c 9 netperf -H 1.1.1.1 -t TCP_RR -l 10
      5. Observe behavior:
      Application's traffic should be restricted to the CPU provided in
      taskset.
      
      Fixes: 89ec1f08
      
       ("i40e: Fix queue-to-TC mapping on Tx")
      Signed-off-by: default avatarPrzemyslaw Patynowski <przemyslawx.patynowski@intel.com>
      Signed-off-by: default avatarArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
      Tested-by: default avatarDave Switzer <david.switzer@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a222be59