Skip to content
Snippets Groups Projects
  1. Mar 16, 2022
    • Guchun Chen's avatar
      drm/amdgpu: bypass tiling flag check in virtual display case (v2) · fcd1d79a
      Guchun Chen authored
      
      [ Upstream commit e2b993302f40c4eb714ecf896dd9e1c5be7d4cd7 ]
      
      vkms leverages common amdgpu framebuffer creation, and
      also as it does not support FB modifier, there is no need
      to check tiling flags when initing framebuffer when virtual
      display is enabled.
      
      This can fix below calltrace:
      
      amdgpu 0000:00:08.0: GFX9+ requires FB check based on format modifier
      WARNING: CPU: 0 PID: 1023 at drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1150 amdgpu_display_framebuffer_init+0x8e7/0xb40 [amdgpu]
      
      v2: check adev->enable_virtual_display instead as vkms can be
      	enabled in bare metal as well.
      
      Signed-off-by: default avatarLeslie Shi <Yuliang.Shi@amd.com>
      Signed-off-by: default avatarGuchun Chen <guchun.chen@amd.com>
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fcd1d79a
    • Shreeya Patel's avatar
      gpio: Return EPROBE_DEFER if gc->to_irq is NULL · 5cf4dd01
      Shreeya Patel authored
      [ Upstream commit ae42f9288846353982e2eab181fb41e7fd8bf60f ]
      
      We are racing the registering of .to_irq when probing the
      i2c driver. This results in random failure of touchscreen
      devices.
      
      Following explains the race condition better.
      
      [gpio driver] gpio driver registers gpio chip
      [gpio consumer] gpio is acquired
      [gpio consumer] gpiod_to_irq() fails with -ENXIO
      [gpio driver] gpio driver registers irqchip
      gpiod_to_irq works at this point, but -ENXIO is fatal
      
      We could see the following errors in dmesg logs when gc->to_irq is NULL
      
      [2.101857] i2c_hid i2c-FTS3528:00: HID over i2c has not been provided an Int IRQ
      [2.101953] i2c_hid: probe of i2c-FTS3528:00 failed with error -22
      
      To avoid this situation, defer probing until to_irq is registered.
      Returning -EPROBE_DEFER would be the first step towards avoiding
      the failure of devices due to the race in registration of .to_irq.
      Final solution to this issue would be to avoid using gc irq members
      until they are fully initialized.
      
      This issue has been reported many times in past and people have been
      using workarounds like changing the pinctrl_amd to built-in instead
      of loading it as a module or by adding a softdep for pinctrl_amd into
      the config file.
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=209413
      
      
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarShreeya Patel <shreeya.patel@collabora.com>
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5cf4dd01
    • Alex Deucher's avatar
      PCI: Mark all AMD Navi10 and Navi14 GPU ATS as broken · 94b568a9
      Alex Deucher authored
      [ Upstream commit 3f1271b54edcc692da5a3663f2aa2a64781f9bc3 ]
      
      There are enough VBIOS escapes without the proper workaround that some
      users still hit this.  Microsoft never productized ATS on Windows so OEM
      platforms that were Windows-only didn't always validate ATS.
      
      The advantages of ATS are not worth it compared to the potential
      instabilities on harvested boards.  Disable ATS on all Navi10 and Navi14
      boards.
      
      Symptoms include:
      
        amdgpu 0000:07:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0007 address=0xffffc02000 flags=0x0000]
        AMD-Vi: Event logged [IO_PAGE_FAULT device=07:00.0 domain=0x0007 address=0xffffc02000 flags=0x0000]
        [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring sdma0 timeout, signaled seq=6047, emitted seq=6049
        amdgpu 0000:07:00.0: amdgpu: GPU reset begin!
        amdgpu 0000:07:00.0: amdgpu: GPU reset succeeded, trying to resume
        amdgpu 0000:07:00.0: [drm:amdgpu_ring_test_helper [amdgpu]] *ERROR* ring sdma0 test failed (-110)
        [drm:amdgpu_device_ip_resume_phase2 [amdgpu]] *ERROR* resume of IP block <sdma_v4_0> failed -110
        amdgpu 0000:07:00.0: amdgpu: GPU reset(1) failed
      
      Related commits:
      
        e8946a53 ("PCI: Mark AMD Navi14 GPU ATS as broken")
        a2da5d8c ("PCI: Mark AMD Raven iGPU ATS as broken in some platforms")
        45beb31d ("PCI: Mark AMD Navi10 GPU rev 0x00 ATS as broken")
        5e89cd30 ("PCI: Mark AMD Navi14 GPU rev 0xc5 ATS as broken")
        d28ca864 ("PCI: Mark AMD Stoney Radeon R7 GPU ATS as broken")
        9b44b0b0 ("PCI: Mark AMD Stoney GPU ATS as broken")
      
      [bhelgaas: add symptoms and related commits]
      Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1760
      Link: https://lore.kernel.org/r/20220222160801.841643-1-alexander.deucher@amd.com
      
      
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Acked-by: default avatarGuchun Chen <guchun.chen@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      94b568a9
    • Vikash Chandola's avatar
      hwmon: (pmbus) Clear pmbus fault/warning bits after read · bb9795b6
      Vikash Chandola authored
      
      [ Upstream commit 35f165f08950a876f1b95a61d79c93678fba2fd6 ]
      
      Almost all fault/warning bits in pmbus status registers remain set even
      after fault/warning condition are removed. As per pmbus specification
      these faults must be cleared by user.
      Modify hwmon behavior to clear fault/warning bit after fetching data if
      fault/warning bit was set. This allows to get fresh data in next read.
      
      Signed-off-by: default avatarVikash Chandola <vikash.chandola@linux.intel.com>
      Link: https://lore.kernel.org/r/20220222131253.2426834-1-vikash.chandola@linux.intel.com
      
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bb9795b6
    • suresh kumar's avatar
      net-sysfs: add check for netdevice being present to speed_show · 8d5e69d8
      suresh kumar authored
      
      [ Upstream commit 4224cfd7fb6523f7a9d1c8bb91bb5df1e38eb624 ]
      
      When bringing down the netdevice or system shutdown, a panic can be
      triggered while accessing the sysfs path because the device is already
      removed.
      
          [  755.549084] mlx5_core 0000:12:00.1: Shutdown was called
          [  756.404455] mlx5_core 0000:12:00.0: Shutdown was called
          ...
          [  757.937260] BUG: unable to handle kernel NULL pointer dereference at           (null)
          [  758.031397] IP: [<ffffffff8ee11acb>] dma_pool_alloc+0x1ab/0x280
      
          crash> bt
          ...
          PID: 12649  TASK: ffff8924108f2100  CPU: 1   COMMAND: "amsd"
          ...
           #9 [ffff89240e1a38b0] page_fault at ffffffff8f38c778
              [exception RIP: dma_pool_alloc+0x1ab]
              RIP: ffffffff8ee11acb  RSP: ffff89240e1a3968  RFLAGS: 00010046
              RAX: 0000000000000246  RBX: ffff89243d874100  RCX: 0000000000001000
              RDX: 0000000000000000  RSI: 0000000000000246  RDI: ffff89243d874090
              RBP: ffff89240e1a39c0   R8: 000000000001f080   R9: ffff8905ffc03c00
              R10: ffffffffc04680d4  R11: ffffffff8edde9fd  R12: 00000000000080d0
              R13: ffff89243d874090  R14: ffff89243d874080  R15: 0000000000000000
              ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
          #10 [ffff89240e1a39c8] mlx5_alloc_cmd_msg at ffffffffc04680f3 [mlx5_core]
          #11 [ffff89240e1a3a18] cmd_exec at ffffffffc046ad62 [mlx5_core]
          #12 [ffff89240e1a3ab8] mlx5_cmd_exec at ffffffffc046b4fb [mlx5_core]
          #13 [ffff89240e1a3ae8] mlx5_core_access_reg at ffffffffc0475434 [mlx5_core]
          #14 [ffff89240e1a3b40] mlx5e_get_fec_caps at ffffffffc04a7348 [mlx5_core]
          #15 [ffff89240e1a3bb0] get_fec_supported_advertised at ffffffffc04992bf [mlx5_core]
          #16 [ffff89240e1a3c08] mlx5e_get_link_ksettings at ffffffffc049ab36 [mlx5_core]
          #17 [ffff89240e1a3ce8] __ethtool_get_link_ksettings at ffffffff8f25db46
          #18 [ffff89240e1a3d48] speed_show at ffffffff8f277208
          #19 [ffff89240e1a3dd8] dev_attr_show at ffffffff8f0b70e3
          #20 [ffff89240e1a3df8] sysfs_kf_seq_show at ffffffff8eedbedf
          #21 [ffff89240e1a3e18] kernfs_seq_show at ffffffff8eeda596
          #22 [ffff89240e1a3e28] seq_read at ffffffff8ee76d10
          #23 [ffff89240e1a3e98] kernfs_fop_read at ffffffff8eedaef5
          #24 [ffff89240e1a3ed8] vfs_read at ffffffff8ee4e3ff
          #25 [ffff89240e1a3f08] sys_read at ffffffff8ee4f27f
          #26 [ffff89240e1a3f50] system_call_fastpath at ffffffff8f395f92
      
          crash> net_device.state ffff89443b0c0000
            state = 0x5  (__LINK_STATE_START| __LINK_STATE_NOCARRIER)
      
      To prevent this scenario, we also make sure that the netdevice is present.
      
      Signed-off-by: default avatarsuresh kumar <suresh2514@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8d5e69d8
    • Wanpeng Li's avatar
      x86/kvm: Don't use pv tlb/ipi/sched_yield if on 1 vCPU · 1280c8ae
      Wanpeng Li authored
      
      [ Upstream commit ec756e40e271866f951d77c5e923d8deb6002b15 ]
      
      Inspired by commit 3553ae56 (x86/kvm: Don't use pvqspinlock code if
      only 1 vCPU), on a VM with only 1 vCPU, there is no need to enable
      pv tlb/ipi/sched_yield and we can save the memory for __pv_cpu_mask.
      
      Signed-off-by: default avatarWanpeng Li <wanpengli@tencent.com>
      Message-Id: <1645171838-2855-1-git-send-email-wanpengli@tencent.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1280c8ae
    • Maxime Ripard's avatar
      drm/vc4: hdmi: Unregister codec device on unbind · ee22082c
      Maxime Ripard authored
      
      [ Upstream commit e40945ab7c7f966d0c37b7bd7b0596497dfe228d ]
      
      On bind we will register the HDMI codec device but we don't unregister
      it on unbind, leading to a device leakage. Unregister our device at
      unbind.
      
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220127111452.222002-1-maxime@cerno.tech
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ee22082c
    • Jon Lin's avatar
      spi: rockchip: terminate dma transmission when slave abort · 5bef4e50
      Jon Lin authored
      
      [ Upstream commit 80808768 ]
      
      After slave abort, all DMA should be stopped, or it will affect the
      next transmission and maybe abort again.
      
      Signed-off-by: default avatarJon Lin <jon.lin@rock-chips.com>
      Link: https://lore.kernel.org/r/20220216014028.8123-3-jon.lin@rock-chips.com
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5bef4e50
    • Jon Lin's avatar
      spi: rockchip: Fix error in getting num-cs property · 1f04bbd2
      Jon Lin authored
      
      [ Upstream commit 9382df0a98aad5bbcd4d634790305a1d786ad224 ]
      
      Get num-cs u32 from dts of_node property rather than u16.
      
      Signed-off-by: default avatarJon Lin <jon.lin@rock-chips.com>
      Link: https://lore.kernel.org/r/20220216014028.8123-2-jon.lin@rock-chips.com
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1f04bbd2
    • Anton Romanov's avatar
      kvm: x86: Disable KVM_HC_CLOCK_PAIRING if tsc is in always catchup mode · bcd4279b
      Anton Romanov authored
      
      [ Upstream commit 3a55f729240a686aa8af00af436306c0cd532522 ]
      
      If vcpu has tsc_always_catchup set each request updates pvclock data.
      KVM_HC_CLOCK_PAIRING consumers such as ptp_kvm_x86 rely on tsc read on
      host's side and do hypercall inside pvclock_read_retry loop leading to
      infinite loop in such situation.
      
      v3:
          Removed warn
          Changed return code to KVM_EFAULT
      v2:
          Added warn
      
      Signed-off-by: default avatarAnton Romanov <romanton@google.com>
      Message-Id: <20220216182653.506850-1-romanton@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bcd4279b
    • Wanpeng Li's avatar
      KVM: Fix lockdep false negative during host resume · e160ee96
      Wanpeng Li authored
      [ Upstream commit 4cb9a998 ]
      
      I saw the below splatting after the host suspended and resumed.
      
         WARNING: CPU: 0 PID: 2943 at kvm/arch/x86/kvm/../../../virt/kvm/kvm_main.c:5531 kvm_resume+0x2c/0x30 [kvm]
         CPU: 0 PID: 2943 Comm: step_after_susp Tainted: G        W IOE     5.17.0-rc3+ #4
         RIP: 0010:kvm_resume+0x2c/0x30 [kvm]
         Call Trace:
          <TASK>
          syscore_resume+0x90/0x340
          suspend_devices_and_enter+0xaee/0xe90
          pm_suspend.cold+0x36b/0x3c2
          state_store+0x82/0xf0
          kernfs_fop_write_iter+0x1b6/0x260
          new_sync_write+0x258/0x370
          vfs_write+0x33f/0x510
          ksys_write+0xc9/0x160
          do_syscall_64+0x3b/0xc0
          entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      lockdep_is_held() can return -1 when lockdep is disabled which triggers
      this warning. Let's use lockdep_assert_not_held() which can detect
      incorrect calls while holding a lock and it also avoids false negatives
      when lockdep is disabled.
      
      Signed-off-by: Wan...
      e160ee96
    • Andy Shevchenko's avatar
      pinctrl: tigerlake: Revert "Add Alder Lake-M ACPI ID" · 302ce294
      Andy Shevchenko authored
      
      [ Upstream commit 6f66db29e2415cbe8759c48584f9cae19b3c2651 ]
      
      It appears that last minute change moved ACPI ID of Alder Lake-M
      to the INTC1055, which is already in the driver.
      
      This ID on the other hand will be used elsewhere.
      
      This reverts commit 258435a1.
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      302ce294
    • Heikki Krogerus's avatar
      usb: dwc3: pci: add support for the Intel Raptor Lake-S · 839ddf78
      Heikki Krogerus authored
      
      [ Upstream commit 038438a25c45d5ac996e95a22fa9e76ff3d1f8c7 ]
      
      This patch adds the necessary PCI ID for Intel Raptor Lake-S
      devices.
      
      Signed-off-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Link: https://lore.kernel.org/r/20220214141948.18637-1-heikki.krogerus@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      839ddf78
    • Halil Pasic's avatar
      swiotlb: fix info leak with DMA_FROM_DEVICE · 7403f411
      Halil Pasic authored
      
      [ Upstream commit ddbd89deb7d32b1fbb879f48d68fda1a8ac58e8e ]
      
      The problem I'm addressing was discovered by the LTP test covering
      cve-2018-1000204.
      
      A short description of what happens follows:
      1) The test case issues a command code 00 (TEST UNIT READY) via the SG_IO
         interface with: dxfer_len == 524288, dxdfer_dir == SG_DXFER_FROM_DEV
         and a corresponding dxferp. The peculiar thing about this is that TUR
         is not reading from the device.
      2) In sg_start_req() the invocation of blk_rq_map_user() effectively
         bounces the user-space buffer. As if the device was to transfer into
         it. Since commit a45b599a ("scsi: sg: allocate with __GFP_ZERO in
         sg_build_indirect()") we make sure this first bounce buffer is
         allocated with GFP_ZERO.
      3) For the rest of the story we keep ignoring that we have a TUR, so the
         device won't touch the buffer we prepare as if the we had a
         DMA_FROM_DEVICE type of situation. My setup uses a virtio-scsi device
         and the  buffer allocated by SG is mapped by the function
         virtqueue_add_split() which uses DMA_FROM_DEVICE for the "in" sgs (here
         scatter-gather and not scsi generics). This mapping involves bouncing
         via the swiotlb (we need swiotlb to do virtio in protected guest like
         s390 Secure Execution, or AMD SEV).
      4) When the SCSI TUR is done, we first copy back the content of the second
         (that is swiotlb) bounce buffer (which most likely contains some
         previous IO data), to the first bounce buffer, which contains all
         zeros.  Then we copy back the content of the first bounce buffer to
         the user-space buffer.
      5) The test case detects that the buffer, which it zero-initialized,
        ain't all zeros and fails.
      
      One can argue that this is an swiotlb problem, because without swiotlb
      we leak all zeros, and the swiotlb should be transparent in a sense that
      it does not affect the outcome (if all other participants are well
      behaved).
      
      Copying the content of the original buffer into the swiotlb buffer is
      the only way I can think of to make swiotlb transparent in such
      scenarios. So let's do just that if in doubt, but allow the driver
      to tell us that the whole mapped buffer is going to be overwritten,
      in which case we can preserve the old behavior and avoid the performance
      impact of the extra bounce.
      
      Signed-off-by: default avatarHalil Pasic <pasic@linux.ibm.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7403f411
    • Kumar Kartikeya Dwivedi's avatar
      selftests/bpf: Add test for bpf_timer overwriting crash · b0028e1c
      Kumar Kartikeya Dwivedi authored
      
      [ Upstream commit a7e75016a0753c24d6c995bc02501ae35368e333 ]
      
      Add a test that validates that timer value is not overwritten when doing
      a copy_map_value call in the kernel. Without the prior fix, this test
      triggers a crash.
      
      Signed-off-by: default avatarKumar Kartikeya Dwivedi <memxor@gmail.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20220209070324.1093182-3-memxor@gmail.com
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b0028e1c
    • Heiner Kallweit's avatar
      net: phy: meson-gxl: improve link-up behavior · 732c7172
      Heiner Kallweit authored
      
      [ Upstream commit 2c87c6f9fbddc5b84d67b2fa3f432fcac6d99d93 ]
      
      Sometimes the link comes up but no data flows. This patch fixes
      this behavior. It's not clear what's the root cause of the issue.
      
      According to the tests one other link-up issue remains.
      In very rare cases the link isn't even reported as up.
      
      Fixes: 84c8f773 ("net: phy: meson-gxl: remove the use of .ack_callback()")
      Tested-by: default avatarErico Nunes <nunes.erico@gmail.com>
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Link: https://lore.kernel.org/r/e3473452-a1f9-efcf-5fdd-02b6f44c3fcd@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      732c7172
    • Jeremy Linton's avatar
      net: bcmgenet: Don't claim WOL when its not available · 6c0d2f34
      Jeremy Linton authored
      
      [ Upstream commit 00b022f8f876a3a036b0df7f971001bef6398605 ]
      
      Some of the bcmgenet platforms don't correctly support WOL, yet
      ethtool returns:
      
      "Supports Wake-on: gsf"
      
      which is false.
      
      Ideally if there isn't a wol_irq, or there is something else that
      keeps the device from being able to wakeup it should display:
      
      "Supports Wake-on: d"
      
      This patch checks whether the device can wakup, before using the
      hard-coded supported flags. This corrects the ethtool reporting, as
      well as the WOL configuration because ethtool verifies that the mode
      is supported before attempting it.
      
      Fixes: c51de7f3 ("net: bcmgenet: add Wake-on-LAN support code")
      Signed-off-by: default avatarJeremy Linton <jeremy.linton@arm.com>
      Tested-by: default avatarPeter Robinson <pbrobinson@gmail.com>
      Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20220310045535.224450-1-jeremy.linton@arm.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6c0d2f34
    • Eric Dumazet's avatar
      sctp: fix kernel-infoleak for SCTP sockets · 1502f15b
      Eric Dumazet authored
      
      [ Upstream commit 633593a808980f82d251d0ca89730d8bb8b0220c ]
      
      syzbot reported a kernel infoleak [1] of 4 bytes.
      
      After analysis, it turned out r->idiag_expires is not initialized
      if inet_sctp_diag_fill() calls inet_diag_msg_common_fill()
      
      Make sure to clear idiag_timer/idiag_retrans/idiag_expires
      and let inet_diag_msg_sctpasoc_fill() fill them again if needed.
      
      [1]
      
      BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:121 [inline]
      BUG: KMSAN: kernel-infoleak in copyout lib/iov_iter.c:154 [inline]
      BUG: KMSAN: kernel-infoleak in _copy_to_iter+0x6ef/0x25a0 lib/iov_iter.c:668
       instrument_copy_to_user include/linux/instrumented.h:121 [inline]
       copyout lib/iov_iter.c:154 [inline]
       _copy_to_iter+0x6ef/0x25a0 lib/iov_iter.c:668
       copy_to_iter include/linux/uio.h:162 [inline]
       simple_copy_to_iter+0xf3/0x140 net/core/datagram.c:519
       __skb_datagram_iter+0x2d5/0x11b0 net/core/datagram.c:425
       skb_copy_datagram_iter+0xdc/0x270 net/core/datagram.c:533
       skb_copy_datagram_msg include/linux/skbuff.h:3696 [inline]
       netlink_recvmsg+0x669/0x1c80 net/netlink/af_netlink.c:1977
       sock_recvmsg_nosec net/socket.c:948 [inline]
       sock_recvmsg net/socket.c:966 [inline]
       __sys_recvfrom+0x795/0xa10 net/socket.c:2097
       __do_sys_recvfrom net/socket.c:2115 [inline]
       __se_sys_recvfrom net/socket.c:2111 [inline]
       __x64_sys_recvfrom+0x19d/0x210 net/socket.c:2111
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Uninit was created at:
       slab_post_alloc_hook mm/slab.h:737 [inline]
       slab_alloc_node mm/slub.c:3247 [inline]
       __kmalloc_node_track_caller+0xe0c/0x1510 mm/slub.c:4975
       kmalloc_reserve net/core/skbuff.c:354 [inline]
       __alloc_skb+0x545/0xf90 net/core/skbuff.c:426
       alloc_skb include/linux/skbuff.h:1158 [inline]
       netlink_dump+0x3e5/0x16c0 net/netlink/af_netlink.c:2248
       __netlink_dump_start+0xcf8/0xe90 net/netlink/af_netlink.c:2373
       netlink_dump_start include/linux/netlink.h:254 [inline]
       inet_diag_handler_cmd+0x2e7/0x400 net/ipv4/inet_diag.c:1341
       sock_diag_rcv_msg+0x24a/0x620
       netlink_rcv_skb+0x40c/0x7e0 net/netlink/af_netlink.c:2494
       sock_diag_rcv+0x63/0x80 net/core/sock_diag.c:277
       netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
       netlink_unicast+0x1093/0x1360 net/netlink/af_netlink.c:1343
       netlink_sendmsg+0x14d9/0x1720 net/netlink/af_netlink.c:1919
       sock_sendmsg_nosec net/socket.c:705 [inline]
       sock_sendmsg net/socket.c:725 [inline]
       sock_write_iter+0x594/0x690 net/socket.c:1061
       do_iter_readv_writev+0xa7f/0xc70
       do_iter_write+0x52c/0x1500 fs/read_write.c:851
       vfs_writev fs/read_write.c:924 [inline]
       do_writev+0x645/0xe00 fs/read_write.c:967
       __do_sys_writev fs/read_write.c:1040 [inline]
       __se_sys_writev fs/read_write.c:1037 [inline]
       __x64_sys_writev+0xe5/0x120 fs/read_write.c:1037
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Bytes 68-71 of 2508 are uninitialized
      Memory access of size 2508 starts at ffff888114f9b000
      Data copied to user address 00007f7fe09ff2e0
      
      CPU: 1 PID: 3478 Comm: syz-executor306 Not tainted 5.17.0-rc4-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      
      Fixes: 8f840e47 ("sctp: add the sctp_diag.c file")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Cc: Vlad Yasevich <vyasevich@gmail.com>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Reviewed-by: default avatarXin Long <lucien.xin@gmail.com>
      Link: https://lore.kernel.org/r/20220310001145.297371-1-eric.dumazet@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1502f15b
    • Clément Léger's avatar
      net: phy: DP83822: clear MISR2 register to disable interrupts · 9ca50a73
      Clément Léger authored
      
      [ Upstream commit 37c9d66c95564c85a001d8a035354f0220a1e1c3 ]
      
      MISR1 was cleared twice but the original author intention was probably
      to clear MISR1 & MISR2 to completely disable interrupts. Fix it to
      clear MISR2.
      
      Fixes: 87461f7a ("net: phy: DP83822 initial driver submission")
      Signed-off-by: default avatarClément Léger <clement.leger@bootlin.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20220309142228.761153-1-clement.leger@bootlin.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9ca50a73
    • Miaoqian Lin's avatar
      gianfar: ethtool: Fix refcount leak in gfar_get_ts_info · f49f646f
      Miaoqian Lin authored
      
      [ Upstream commit 2ac5b58e645c66932438bb021cb5b52097ce70b0 ]
      
      The of_find_compatible_node() function returns a node pointer with
      refcount incremented, We should use of_node_put() on it when done
      Add the missing of_node_put() to release the refcount.
      
      Fixes: 7349a74e ("net: ethernet: gianfar_ethtool: get phc index through drvdata")
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Reviewed-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
      Link: https://lore.kernel.org/r/20220310015313.14938-1-linmq006@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f49f646f
    • Mark Featherston's avatar
      gpio: ts4900: Do not set DAT and OE together · c7f6accc
      Mark Featherston authored
      
      [ Upstream commit 03fe003547975680fdb9ff5ab0e41cb68276c4f2 ]
      
      This works around an issue with the hardware where both OE and
      DAT are exposed in the same register. If both are updated
      simultaneously, the harware makes no guarantees that OE or DAT
      will actually change in any given order and may result in a
      glitch of a few ns on a GPIO pin when changing direction and value
      in a single write.
      
      Setting direction to input now only affects OE bit. Setting
      direction to output updates DAT first, then OE.
      
      Fixes: 9c668632 ("gpio: add Technologic I2C-FPGA gpio support")
      Signed-off-by: default avatarMark Featherston <mark@embeddedTS.com>
      Signed-off-by: default avatarKris Bahnsen <kris@embeddedTS.com>
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c7f6accc
    • Guillaume Nault's avatar
      selftests: pmtu.sh: Kill nettest processes launched in subshell. · c614aad2
      Guillaume Nault authored
      
      [ Upstream commit 94a4a4fe4c696413932eed8bdec46574de9576b8 ]
      
      When using "run_cmd <command> &", then "$!" refers to the PID of the
      subshell used to run <command>, not the command itself. Therefore
      nettest_pids actually doesn't contain the list of the nettest commands
      running in the background. So cleanup() can't kill them and the nettest
      processes run until completion (fortunately they have a 5s timeout).
      
      Fix this by defining a new command for running processes in the
      background, for which "$!" really refers to the PID of the command run.
      
      Also, double quote variables on the modified lines, to avoid shellcheck
      warnings.
      
      Fixes: ece1278a ("selftests: net: add ESP-in-UDP PMTU test")
      Signed-off-by: default avatarGuillaume Nault <gnault@redhat.com>
      Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c614aad2
    • Guillaume Nault's avatar
      selftests: pmtu.sh: Kill tcpdump processes launched by subshell. · d4dfc94c
      Guillaume Nault authored
      
      [ Upstream commit 18dfc667550fe9c032a6dcc3402b50e691e18029 ]
      
      The cleanup() function takes care of killing processes launched by the
      test functions. It relies on variables like ${tcpdump_pids} to get the
      relevant PIDs. But tests are run in their own subshell, so updated
      *_pids values are invisible to other shells. Therefore cleanup() never
      sees any process to kill:
      
      $ ./tools/testing/selftests/net/pmtu.sh -t pmtu_ipv4_exception
      TEST: ipv4: PMTU exceptions                                         [ OK ]
      TEST: ipv4: PMTU exceptions - nexthop objects                       [ OK ]
      
      $ pgrep -af tcpdump
      6084 tcpdump -s 0 -i veth_A-R1 -w pmtu_ipv4_exception_veth_A-R1.pcap
      6085 tcpdump -s 0 -i veth_R1-A -w pmtu_ipv4_exception_veth_R1-A.pcap
      6086 tcpdump -s 0 -i veth_R1-B -w pmtu_ipv4_exception_veth_R1-B.pcap
      6087 tcpdump -s 0 -i veth_B-R1 -w pmtu_ipv4_exception_veth_B-R1.pcap
      6088 tcpdump -s 0 -i veth_A-R2 -w pmtu_ipv4_exception_veth_A-R2.pcap
      6089 tcpdump -s 0 -i veth_R2-A -w pmtu_ipv4_exception_veth_R2-A.pcap
      6090 tcpdump -s 0 -i veth_R2-B -w pmtu_ipv4_exception_veth_R2-B.pcap
      6091 tcpdump -s 0 -i veth_B-R2 -w pmtu_ipv4_exception_veth_B-R2.pcap
      6228 tcpdump -s 0 -i veth_A-R1 -w pmtu_ipv4_exception_veth_A-R1.pcap
      6229 tcpdump -s 0 -i veth_R1-A -w pmtu_ipv4_exception_veth_R1-A.pcap
      6230 tcpdump -s 0 -i veth_R1-B -w pmtu_ipv4_exception_veth_R1-B.pcap
      6231 tcpdump -s 0 -i veth_B-R1 -w pmtu_ipv4_exception_veth_B-R1.pcap
      6232 tcpdump -s 0 -i veth_A-R2 -w pmtu_ipv4_exception_veth_A-R2.pcap
      6233 tcpdump -s 0 -i veth_R2-A -w pmtu_ipv4_exception_veth_R2-A.pcap
      6234 tcpdump -s 0 -i veth_R2-B -w pmtu_ipv4_exception_veth_R2-B.pcap
      6235 tcpdump -s 0 -i veth_B-R2 -w pmtu_ipv4_exception_veth_B-R2.pcap
      
      Fix this by running cleanup() in the context of the test subshell.
      Now that each test cleans the environment after completion, there's no
      need for calling cleanup() again when the next test starts. So let's
      drop it from the setup() function. This is okay because cleanup() is
      also called when pmtu.sh starts, so even the first test starts in a
      clean environment.
      
      Also, use tcpdump's immediate mode. Otherwise it might not have time to
      process buffered packets, resulting in missing packets or even empty
      pcap files for short tests.
      
      Note: PAUSE_ON_FAIL is still evaluated before cleanup(), so one can
      still inspect the test environment upon failure when using -p.
      
      Fixes: a92a0a7b ("selftests: pmtu: Simplify cleanup and namespace names")
      Signed-off-by: default avatarGuillaume Nault <gnault@redhat.com>
      Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d4dfc94c
    • Pavel Skripkin's avatar
      NFC: port100: fix use-after-free in port100_send_complete · 0e721b8f
      Pavel Skripkin authored
      
      [ Upstream commit f80cfe2f26581f188429c12bd937eb905ad3ac7b ]
      
      Syzbot reported UAF in port100_send_complete(). The root case is in
      missing usb_kill_urb() calls on error handling path of ->probe function.
      
      port100_send_complete() accesses devm allocated memory which will be
      freed on probe failure. We should kill this urbs before returning an
      error from probe function to prevent reported use-after-free
      
      Fail log:
      
      BUG: KASAN: use-after-free in port100_send_complete+0x16e/0x1a0 drivers/nfc/port100.c:935
      Read of size 1 at addr ffff88801bb59540 by task ksoftirqd/2/26
      ...
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
       print_address_description.constprop.0.cold+0x8d/0x303 mm/kasan/report.c:255
       __kasan_report mm/kasan/report.c:442 [inline]
       kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
       port100_send_complete+0x16e/0x1a0 drivers/nfc/port100.c:935
       __usb_hcd_giveback_urb+0x2b0/0x5c0 drivers/usb/core/hcd.c:1670
      
      ...
      
      Allocated by task 1255:
       kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
       kasan_set_track mm/kasan/common.c:45 [inline]
       set_alloc_info mm/kasan/common.c:436 [inline]
       ____kasan_kmalloc mm/kasan/common.c:515 [inline]
       ____kasan_kmalloc mm/kasan/common.c:474 [inline]
       __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:524
       alloc_dr drivers/base/devres.c:116 [inline]
       devm_kmalloc+0x96/0x1d0 drivers/base/devres.c:823
       devm_kzalloc include/linux/device.h:209 [inline]
       port100_probe+0x8a/0x1320 drivers/nfc/port100.c:1502
      
      Freed by task 1255:
       kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
       kasan_set_track+0x21/0x30 mm/kasan/common.c:45
       kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
       ____kasan_slab_free mm/kasan/common.c:366 [inline]
       ____kasan_slab_free+0xff/0x140 mm/kasan/common.c:328
       kasan_slab_free include/linux/kasan.h:236 [inline]
       __cache_free mm/slab.c:3437 [inline]
       kfree+0xf8/0x2b0 mm/slab.c:3794
       release_nodes+0x112/0x1a0 drivers/base/devres.c:501
       devres_release_all+0x114/0x190 drivers/base/devres.c:530
       really_probe+0x626/0xcc0 drivers/base/dd.c:670
      
      Reported-and-tested-by: default avatar <syzbot+16bcb127fb73baeecb14@syzkaller.appspotmail.com>
      Fixes: 0347a6ab ("NFC: port100: Commands mechanism implementation")
      Signed-off-by: default avatarPavel Skripkin <paskripkin@gmail.com>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
      Link: https://lore.kernel.org/r/20220308185007.6987-1-paskripkin@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0e721b8f
    • Roi Dayan's avatar
      net/mlx5e: Lag, Only handle events from highest priority multipath entry · a2355333
      Roi Dayan authored
      
      [ Upstream commit ad11c4f1d8fd1f03639460e425a36f7fd0ea83f5 ]
      
      There could be multiple multipath entries but changing the port affinity
      for each one doesn't make much sense and there should be a default one.
      So only track the entry with lowest priority value.
      The commit doesn't affect existing users with a single entry.
      
      Fixes: 544fe7c2 ("net/mlx5e: Activate HW multipath and handle port affinity based on FIB events")
      Signed-off-by: default avatarRoi Dayan <roid@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a2355333
    • Moshe Shemesh's avatar
      net/mlx5: Fix a race on command flush flow · 7c519f76
      Moshe Shemesh authored
      
      [ Upstream commit 063bd355595428750803d8736a9bb7c8db67d42d ]
      
      Fix a refcount use after free warning due to a race on command entry.
      Such race occurs when one of the commands releases its last refcount and
      frees its index and entry while another process running command flush
      flow takes refcount to this command entry. The process which handles
      commands flush may see this command as needed to be flushed if the other
      process released its refcount but didn't release the index yet. Fix it
      by adding the needed spin lock.
      
      It fixes the following warning trace:
      
      refcount_t: addition on 0; use-after-free.
      WARNING: CPU: 11 PID: 540311 at lib/refcount.c:25 refcount_warn_saturate+0x80/0xe0
      ...
      RIP: 0010:refcount_warn_saturate+0x80/0xe0
      ...
      Call Trace:
       <TASK>
       mlx5_cmd_trigger_completions+0x293/0x340 [mlx5_core]
       mlx5_cmd_flush+0x3a/0xf0 [mlx5_core]
       enter_error_state+0x44/0x80 [mlx5_core]
       mlx5_fw_fatal_reporter_err_work+0x37/0xe0 [mlx5_core]
       process_one_work+0x1be/0x390
       worker_thread+0x4d/0x3d0
       ? rescuer_thread+0x350/0x350
       kthread+0x141/0x160
       ? set_kthread_struct+0x40/0x40
       ret_from_fork+0x1f/0x30
       </TASK>
      
      Fixes: 50b2412b ("net/mlx5: Avoid possible free of command entry while timeout comp handler")
      Signed-off-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Reviewed-by: default avatarEran Ben Elisha <eranbe@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7c519f76
    • Mohammad Kabat's avatar
      net/mlx5: Fix size field in bufferx_reg struct · b3d4a7dc
      Mohammad Kabat authored
      
      [ Upstream commit ac77998b7ac3044f0509b097da9637184598980d ]
      
      According to HW spec the field "size" should be 16 bits
      in bufferx register.
      
      Fixes: e281682b ("net/mlx5_core: HW data structs/types definitions cleanup")
      Signed-off-by: default avatarMohammad Kabat <mohammadkab@nvidia.com>
      Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b3d4a7dc
    • Duoming Zhou's avatar
      ax25: Fix NULL pointer dereference in ax25_kill_by_device · 46ad629e
      Duoming Zhou authored
      
      [ Upstream commit 71171ac8 ]
      
      When two ax25 devices attempted to establish connection, the requester use ax25_create(),
      ax25_bind() and ax25_connect() to initiate connection. The receiver use ax25_rcv() to
      accept connection and use ax25_create_cb() in ax25_rcv() to create ax25_cb, but the
      ax25_cb->sk is NULL. When the receiver is detaching, a NULL pointer dereference bug
      caused by sock_hold(sk) in ax25_kill_by_device() will happen. The corresponding
      fail log is shown below:
      
      ===============================================================
      BUG: KASAN: null-ptr-deref in ax25_device_event+0xfd/0x290
      Call Trace:
      ...
      ax25_device_event+0xfd/0x290
      raw_notifier_call_chain+0x5e/0x70
      dev_close_many+0x174/0x220
      unregister_netdevice_many+0x1f7/0xa60
      unregister_netdevice_queue+0x12f/0x170
      unregister_netdev+0x13/0x20
      mkiss_close+0xcd/0x140
      tty_ldisc_release+0xc0/0x220
      tty_release_struct+0x17/0xa0
      tty_release+0x62d/0x670
      ...
      
      This patch add condition check in ax25_kill_by_device(). If s->sk is
      NULL, it will goto if branch to kill device.
      
      Fixes: 4e0f718d ("ax25: improve the incomplete fix to avoid UAF and NPD bugs")
      Reported-by: default avatarThomas Osterried <thomas@osterried.de>
      Signed-off-by: default avatarDuoming Zhou <duoming@zju.edu.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      46ad629e
    • Miaoqian Lin's avatar
      net: marvell: prestera: Add missing of_node_put() in prestera_switch_set_base_mac_addr · b7c2fd1d
      Miaoqian Lin authored
      
      [ Upstream commit c9ffa3e2bc451816ce0295e40063514fabf2bd36 ]
      
      This node pointer is returned by of_find_compatible_node() with
      refcount incremented. Calling of_node_put() to aovid the refcount leak.
      
      Fixes: 501ef306 ("net: marvell: prestera: Add driver for Prestera family ASIC devices")
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b7c2fd1d
    • Jiasheng Jiang's avatar
      net: ethernet: lpc_eth: Handle error for clk_enable · 6e294d38
      Jiasheng Jiang authored
      
      [ Upstream commit 2169b79258c8be803d2595d6456b1e77129fe154 ]
      
      As the potential failure of the clk_enable(),
      it should be better to check it and return error
      if fails.
      
      Fixes: b7370112 ("lpc32xx: Added ethernet driver")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6e294d38
    • Jiasheng Jiang's avatar
      net: ethernet: ti: cpts: Handle error for clk_enable · c746fa0f
      Jiasheng Jiang authored
      
      [ Upstream commit 6babfc6e6fab068018c36e8f6605184b8c0b349d ]
      
      As the potential failure of the clk_enable(),
      it should be better to check it and return error
      if fails.
      
      Fixes: 8a2c9a5a ("net: ethernet: ti: cpts: rework initialization/deinitialization")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c746fa0f
    • Tung Nguyen's avatar
      tipc: fix incorrect order of state message data sanity check · 5548c81e
      Tung Nguyen authored
      
      [ Upstream commit c79fcc27be90b308b3fa90811aefafdd4078668c ]
      
      When receiving a state message, function tipc_link_validate_msg()
      is called to validate its header portion. Then, its data portion
      is validated before it can be accessed correctly. However, current
      data sanity  check is done after the message header is accessed to
      update some link variables.
      
      This commit fixes this issue by moving the data sanity check to
      the beginning of state message handling and right after the header
      sanity check.
      
      Fixes: 9aa422ad3266 ("tipc: improve size validations for received domain records")
      Acked-by: default avatarJon Maloy <jmaloy@redhat.com>
      Signed-off-by: default avatarTung Nguyen <tung.q.nguyen@dektech.com.au>
      Link: https://lore.kernel.org/r/20220308021200.9245-1-tung.q.nguyen@dektech.com.au
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5548c81e
    • Miaoqian Lin's avatar
      ethernet: Fix error handling in xemaclite_of_probe · 5e7c4028
      Miaoqian Lin authored
      
      [ Upstream commit b19ab4b38b06aae12442b2de95ccf58b5dc53584 ]
      
      This node pointer is returned by of_parse_phandle() with refcount
      incremented in this function. Calling of_node_put() to avoid the
      refcount leak. As the remove function do.
      
      Fixes: 5cdaaa12 ("net: emaclite: adding MDIO and phy lib support")
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20220308024751.2320-1-linmq006@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5e7c4028
    • Jedrzej Jagielski's avatar
      ice: Fix curr_link_speed advertised speed · 06a97a7a
      Jedrzej Jagielski authored
      
      [ Upstream commit ad35ffa252af67d4cc7c744b9377a2b577748e3f ]
      
      Change curr_link_speed advertised speed, due to
      link_info.link_speed is not equal phy.curr_user_speed_req.
      Without this patch it is impossible to set advertised
      speed to same as link_speed.
      
      Testing Hints: Try to set advertised speed
      to 25G only with 25G default link (use ethtool -s 0x80000000)
      
      Fixes: 48cb27f2 ("ice: Implement handlers for ethtool PHY/link operations")
      Signed-off-by: default avatarGrzegorz Siwik <grzegorz.siwik@intel.com>
      Signed-off-by: default avatarJedrzej Jagielski <jedrzej.jagielski@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      06a97a7a
    • Christophe JAILLET's avatar
      ice: Don't use GFP_KERNEL in atomic context · fd0ca20f
      Christophe JAILLET authored
      
      [ Upstream commit 3d97f1afd8d831e0c0dc1157418f94b8faa97b54 ]
      
      ice_misc_intr() is an irq handler. It should not sleep.
      
      Use GFP_ATOMIC instead of GFP_KERNEL when allocating some memory.
      
      Fixes: 348048e7 ("ice: Implement iidc operations")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Tested-by: default avatarLeszek Kaliszczuk <leszek.kaliszczuk@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fd0ca20f
    • Dave Ertman's avatar
      ice: Fix error with handling of bonding MTU · 15d1271d
      Dave Ertman authored
      
      [ Upstream commit 97b0129146b1544bbb0773585327896da3bb4e0a ]
      
      When a bonded interface is destroyed, .ndo_change_mtu can be called
      during the tear-down process while the RTNL lock is held.  This is a
      problem since the auxiliary driver linked to the LAN driver needs to be
      notified of the MTU change, and this requires grabbing a device_lock on
      the auxiliary_device's dev.  Currently this is being attempted in the
      same execution context as the call to .ndo_change_mtu which is causing a
      dead-lock.
      
      Move the notification of the changed MTU to a separate execution context
      (watchdog service task) and eliminate the "before" notification.
      
      Fixes: 348048e7 ("ice: Implement iidc operations")
      Signed-off-by: default avatarDave Ertman <david.m.ertman@intel.com>
      Tested-by: default avatarJonathan Toppins <jtoppins@redhat.com>
      Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      15d1271d
    • Jacob Keller's avatar
      ice: stop disabling VFs due to PF error responses · 9bda6a09
      Jacob Keller authored
      
      [ Upstream commit 79498d5af8e458102242d1667cf44df1f1564e63 ]
      
      The ice_vc_send_msg_to_vf function has logic to detect "failure"
      responses being sent to a VF. If a VF is sent more than
      ICE_DFLT_NUM_INVAL_MSGS_ALLOWED then the VF is marked as disabled.
      Almost identical logic also existed in the i40e driver.
      
      This logic was added to the ice driver in commit 1071a835 ("ice:
      Implement virtchnl commands for AVF support") which itself copied from
      the i40e implementation in commit 5c3c48ac ("i40e: implement virtual
      device interface").
      
      Neither commit provides a proper explanation or justification of the
      check. In fact, later commits to i40e changed the logic to allow
      bypassing the check in some specific instances.
      
      The "logic" for this seems to be that error responses somehow indicate a
      malicious VF. This is not really true. The PF might be sending an error
      for any number of reasons such as lack of resources, etc.
      
      Additionally, this causes the PF to log an info message for every failed
      VF response which may confuse users, and can spam the kernel log.
      
      This behavior is not documented as part of any requirement for our
      products and other operating system drivers such as the FreeBSD
      implementation of our drivers do not include this type of check.
      
      In fact, the change from dev_err to dev_info in i40e commit 18b7af57
      ("i40e: Lower some message levels") explains that these messages
      typically don't actually indicate a real issue. It is quite likely that
      a user who hits this in practice will be very confused as the VF will be
      disabled without an obvious way to recover.
      
      We already have robust malicious driver detection logic using actual
      hardware detection mechanisms that detect and prevent invalid device
      usage. Remove the logic since its not a documented requirement and the
      behavior is not intuitive.
      
      Fixes: 1071a835 ("ice: Implement virtchnl commands for AVF support")
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9bda6a09
    • Jacob Keller's avatar
      i40e: stop disabling VFs due to PF error responses · 49839cb4
      Jacob Keller authored
      
      [ Upstream commit 5710ab79166504013f7c0ae6a57e7d2fd26e5c43 ]
      
      The i40e_vc_send_msg_to_vf_ex (and its wrapper i40e_vc_send_msg_to_vf)
      function has logic to detect "failure" responses sent to the VF. If a VF
      is sent more than I40E_DEFAULT_NUM_INVALID_MSGS_ALLOWED, then the VF is
      marked as disabled. In either case, a dev_info message is printed
      stating that a VF opcode failed.
      
      This logic originates from the early implementation of VF support in
      commit 5c3c48ac ("i40e: implement virtual device interface").
      
      That commit did not go far enough. The "logic" for this behavior seems
      to be that error responses somehow indicate a malicious VF. This is not
      really true. The PF might be sending an error for any number of reasons
      such as lacking resources, an unsupported operation, etc. This does not
      indicate a malicious VF. We already have a separate robust malicious VF
      detection which relies on hardware logic to detect and prevent a variety
      of behaviors.
      
      There is no justification for this behavior in the original
      implementation. In fact, a later commit 18b7af57 ("i40e: Lower some
      message levels") reduced the opcode failure message from a dev_err to a
      dev_info. In addition, recent commit 01cbf508 ("i40e: Fix to not
      show opcode msg on unsuccessful VF MAC change") changed the logic to
      allow quieting it for expected failures.
      
      That commit prevented this logic from kicking in for specific
      circumstances. This change did not go far enough. The behavior is not
      documented nor is it part of any requirement for our products. Other
      operating systems such as the FreeBSD implementation of our driver do
      not include this logic.
      
      It is clear this check does not make sense, and causes problems which
      led to ugly workarounds.
      
      Fix this by just removing the entire logic and the need for the
      i40e_vc_send_msg_to_vf_ex function.
      
      Fixes: 01cbf508 ("i40e: Fix to not show opcode msg on unsuccessful VF MAC change")
      Fixes: 5c3c48ac ("i40e: implement virtual device interface")
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      49839cb4
    • Michal Maloszewski's avatar
      iavf: Fix handling of vlan strip virtual channel messages · 35f11aba
      Michal Maloszewski authored
      
      [ Upstream commit 2cf29e55894886965722e6625f6a03630b4db31d ]
      
      Modify netdev->features for vlan stripping based on virtual
      channel messages received from the PF. Change is needed
      to synchronize vlan strip status between PF sysfs and iavf ethtool.
      
      Fixes: 5951a2b9 ("iavf: Fix VLAN feature flags after VFR")
      Signed-off-by: default avatarNorbert Ciosek <norbertx.ciosek@intel.com>
      Signed-off-by: default avatarMichal Maloszewski <michal.maloszewski@intel.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      35f11aba
    • Joel Stanley's avatar
      ARM: dts: aspeed: Fix AST2600 quad spi group · 0716607a
      Joel Stanley authored
      
      [ Upstream commit 2f6edb6bcb2f3f41d876e0eba2ba97f87a0296ea ]
      
      Requesting quad mode for the FMC resulted in an error:
      
        &fmc {
               status = "okay";
       +       pinctrl-names = "default";
       +       pinctrl-0 = <&pinctrl_fwqspi_default>'
      
      [    0.742963] aspeed-g6-pinctrl 1e6e2000.syscon:pinctrl: invalid function FWQSPID in map table
      
      
      This is because the quad mode pins are a group of pins, not a function.
      
      After applying this patch we can request the pins and the QSPI data
      lines are muxed:
      
       # cat /sys/kernel/debug/pinctrl/1e6e2000.syscon\:pinctrl-aspeed-g6-pinctrl/pinmux-pins |grep 1e620000.spi
       pin 196 (AE12): device 1e620000.spi function FWSPID group FWQSPID
       pin 197 (AF12): device 1e620000.spi function FWSPID group FWQSPID
       pin 240 (Y1): device 1e620000.spi function FWSPID group FWQSPID
       pin 241 (Y2): device 1e620000.spi function FWSPID group FWQSPID
       pin 242 (Y3): device 1e620000.spi function FWSPID group FWQSPID
       pin 243 (Y4): device 1e620000.spi function FWSPID group FWQSPID
      
      Fixes: f510f04c ("ARM: dts: aspeed: Add AST2600 pinmux nodes")
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      Reviewed-by: default avatarAndrew Jeffery <andrew@aj.id.au>
      Link: https://lore.kernel.org/r/20220304011010.974863-1-joel@jms.id.au
      Link: https://lore.kernel.org/r/20220304011010.974863-1-joel@jms.id.au
      
      '
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0716607a
Loading