Skip to content
  1. Apr 10, 2024
    • Samuel Holland's avatar
      riscv: Fix spurious errors from __get/put_kernel_nofault · fd966210
      Samuel Holland authored
      commit d080a08b upstream.
      
      These macros did not initialize __kr_err, so they could fail even if
      the access did not fault.
      
      Cc: stable@vger.kernel.org
      Fixes: d464118c
      
       ("riscv: implement __get_kernel_nofault and __put_user_nofault")
      Signed-off-by: default avatarSamuel Holland <samuel.holland@sifive.com>
      Reviewed-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
      Reviewed-by: default avatarCharlie Jenkins <charlie@rivosinc.com>
      Link: https://lore.kernel.org/r/20240312022030.320789-1-samuel.holland@sifive.com
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fd966210
    • Sumanth Korikkar's avatar
      s390/entry: align system call table on 8 bytes · 6135537e
      Sumanth Korikkar authored
      commit 378ca2d2
      
       upstream.
      
      Align system call table on 8 bytes. With sys_call_table entry size
      of 8 bytes that eliminates the possibility of a system call pointer
      crossing cache line boundary.
      
      Cc: stable@kernel.org
      Suggested-by: default avatarUlrich Weigand <ulrich.weigand@de.ibm.com>
      Reviewed-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Signed-off-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6135537e
    • Borislav Petkov (AMD)'s avatar
      x86/mce: Make sure to grab mce_sysfs_mutex in set_bank() · f8605955
      Borislav Petkov (AMD) authored
      commit 3ddf944b
      
       upstream.
      
      Modifying a MCA bank's MCA_CTL bits which control which error types to
      be reported is done over
      
        /sys/devices/system/machinecheck/
        ├── machinecheck0
        │   ├── bank0
        │   ├── bank1
        │   ├── bank10
        │   ├── bank11
        ...
      
      sysfs nodes by writing the new bit mask of events to enable.
      
      When the write is accepted, the kernel deletes all current timers and
      reinits all banks.
      
      Doing that in parallel can lead to initializing a timer which is already
      armed and in the timer wheel, i.e., in use already:
      
        ODEBUG: init active (active state 0) object: ffff888063a28000 object
        type: timer_list hint: mce_timer_fn+0x0/0x240 arch/x86/kernel/cpu/mce/core.c:2642
        WARNING: CPU: 0 PID: 8120 at lib/debugobjects.c:514
        debug_print_object+0x1a0/0x2a0 lib/debugobjects.c:514
      
      Fix that by grabbing the sysfs mutex as the rest of the MCA sysfs code
      does.
      
      Reported by: Yue Sun <samsun1006219@gmail.com>
      Reported by: xingwei lee <xrivendell7@gmail.com>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Cc: <stable@kernel.org>
      Link: https://lore.kernel.org/r/CAEkJfYNiENwQY8yV1LYJ9LjJs%2Bx_-PqMv98gKig55=2vbzffRw@mail.gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8605955
    • Herve Codina's avatar
      of: dynamic: Synchronize of_changeset_destroy() with the devlink removals · 3ee24241
      Herve Codina authored
      commit 8917e738 upstream.
      
      In the following sequence:
        1) of_platform_depopulate()
        2) of_overlay_remove()
      
      During the step 1, devices are destroyed and devlinks are removed.
      During the step 2, OF nodes are destroyed but
      __of_changeset_entry_destroy() can raise warnings related to missing
      of_node_put():
        ERROR: memory leak, expected refcount 1 instead of 2 ...
      
      Indeed, during the devlink removals performed at step 1, the removal
      itself releasing the device (and the attached of_node) is done by a job
      queued in a workqueue and so, it is done asynchronously with respect to
      function calls.
      When the warning is present, of_node_put() will be called but wrongly
      too late from the workqueue job.
      
      In order to be sure that any ongoing devlink removals are done before
      the of_node destruction, synchronize the of_changeset_destroy() with the
      devlink removals.
      
      Fixes: 80dd33cf
      
       ("drivers: base: Fix device link removal")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHerve Codina <herve.codina@bootlin.com>
      Reviewed-by: default avatarSaravana Kannan <saravanak@google.com>
      Tested-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
      Reviewed-by: default avatarNuno Sa <nuno.sa@analog.com>
      Link: https://lore.kernel.org/r/20240325152140.198219-3-herve.codina@bootlin.com
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3ee24241
    • Herve Codina's avatar
      driver core: Introduce device_link_wait_removal() · 03c35686
      Herve Codina authored
      commit 0462c56c upstream.
      
      The commit 80dd33cf
      
       ("drivers: base: Fix device link removal")
      introduces a workqueue to release the consumer and supplier devices used
      in the devlink.
      In the job queued, devices are release and in turn, when all the
      references to these devices are dropped, the release function of the
      device itself is called.
      
      Nothing is present to provide some synchronisation with this workqueue
      in order to ensure that all ongoing releasing operations are done and
      so, some other operations can be started safely.
      
      For instance, in the following sequence:
        1) of_platform_depopulate()
        2) of_overlay_remove()
      
      During the step 1, devices are released and related devlinks are removed
      (jobs pushed in the workqueue).
      During the step 2, OF nodes are destroyed but, without any
      synchronisation with devlink removal jobs, of_overlay_remove() can raise
      warnings related to missing of_node_put():
        ERROR: memory leak, expected refcount 1 instead of 2
      
      Indeed, the missing of_node_put() call is going to be done, too late,
      from the workqueue job execution.
      
      Introduce device_link_wait_removal() to offer a way to synchronize
      operations waiting for the end of devlink removals (i.e. end of
      workqueue jobs).
      Also, as a flushing operation is done on the workqueue, the workqueue
      used is moved from a system-wide workqueue to a local one.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHerve Codina <herve.codina@bootlin.com>
      Tested-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
      Reviewed-by: default avatarNuno Sa <nuno.sa@analog.com>
      Reviewed-by: default avatarSaravana Kannan <saravanak@google.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Link: https://lore.kernel.org/r/20240325152140.198219-2-herve.codina@bootlin.com
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      03c35686
    • I Gede Agastya Darma Laksana's avatar
      ALSA: hda/realtek: Update Panasonic CF-SZ6 quirk to support headset with microphone · 5e32c0cc
      I Gede Agastya Darma Laksana authored
      commit 1576f263 upstream.
      
      This patch addresses an issue with the Panasonic CF-SZ6's existing quirk,
      specifically its headset microphone functionality. Previously, the quirk
      used ALC269_FIXUP_HEADSET_MODE, which does not support the CF-SZ6's design
      of a single 3.5mm jack for both mic and audio output effectively. The
      device uses pin 0x19 for the headset mic without jack detection.
      
      Following verification on the CF-SZ6 and discussions with the original
      patch author, i determined that the update to
      ALC269_FIXUP_ASPIRE_HEADSET_MIC is the appropriate solution. This change
      is custom-designed for the CF-SZ6's unique hardware setup, which includes
      a single 3.5mm jack for both mic and audio output, connecting the headset
      microphone to pin 0x19 without the use of jack detection.
      
      Fixes: 0fca97a2
      
       ("ALSA: hda/realtek - Add Panasonic CF-SZ6 headset jack quirk")
      Signed-off-by: default avatarI Gede Agastya Darma Laksana <gedeagas22@gmail.com>
      Cc: <stable@vger.kernel.org>
      Message-ID: <20240401174602.14133-1-gedeagas22@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5e32c0cc
    • Jann Horn's avatar
      fs/pipe: Fix lockdep false-positive in watchqueue pipe_write() · de487952
      Jann Horn authored
      [ Upstream commit 055ca835
      
       ]
      
      When you try to splice between a normal pipe and a notification pipe,
      get_pipe_info(..., true) fails, so splice() falls back to treating the
      notification pipe like a normal pipe - so we end up in
      iter_file_splice_write(), which first locks the input pipe, then calls
      vfs_iter_write(), which locks the output pipe.
      
      Lockdep complains about that, because we're taking a pipe lock while
      already holding another pipe lock.
      
      I think this probably (?) can't actually lead to deadlocks, since you'd
      need another way to nest locking a normal pipe into locking a
      watch_queue pipe, but the lockdep annotations don't make that clear.
      
      Bail out earlier in pipe_write() for notification pipes, before taking
      the pipe lock.
      
      Reported-and-tested-by: default avatar <syzbot+011e4ea1da6692cf881c@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=011e4ea1da6692cf881c
      Fixes: c73be61c
      
       ("pipe: Add general notification queue support")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Link: https://lore.kernel.org/r/20231124150822.2121798-1-jannh@google.com
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      de487952
    • Jann Horn's avatar
      openrisc: Fix pagewalk usage in arch_dma_{clear, set}_uncached · eaaaa495
      Jann Horn authored
      [ Upstream commit 28148a17 ]
      
      Since commit 8782fb61 ("mm: pagewalk: Fix race between unmap and page
      walker"), walk_page_range() on kernel ranges won't work anymore,
      walk_page_range_novma() must be used instead.
      
      Note: I don't have an openrisc development setup, so this is completely
      untested.
      
      Fixes: 8782fb61
      
       ("mm: pagewalk: Fix race between unmap and page walker")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      eaaaa495
    • Jann Horn's avatar
      HID: uhid: Use READ_ONCE()/WRITE_ONCE() for ->running · 58e5349b
      Jann Horn authored
      [ Upstream commit c8e7ff41
      
       ]
      
      The flag uhid->running can be set to false by uhid_device_add_worker()
      without holding the uhid->devlock. Mark all reads/writes of the flag
      that might race with READ_ONCE()/WRITE_ONCE() for clarity and
      correctness.
      
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      58e5349b
    • Jeff Layton's avatar
      nfsd: hold a lighter-weight client reference over CB_RECALL_ANY · f7a3090b
      Jeff Layton authored
      [ Upstream commit 10396f4d ]
      
      Currently the CB_RECALL_ANY job takes a cl_rpc_users reference to the
      client. While a callback job is technically an RPC that counter is
      really more for client-driven RPCs, and this has the effect of
      preventing the client from being unhashed until the callback completes.
      
      If nfsd decides to send a CB_RECALL_ANY just as the client reboots, we
      can end up in a situation where the callback can't complete on the (now
      dead) callback channel, but the new client can't connect because the old
      client can't be unhashed. This usually manifests as a NFS4ERR_DELAY
      return on the CREATE_SESSION operation.
      
      The job is only holding a reference to the client so it can clear a flag
      after the RPC completes. Fix this by having CB_RECALL_ANY instead hold a
      reference to the cl_nfsdfs.cl_ref. Typically we only take that sort of
      reference when dealing with the nfsdfs info files, but it should work
      appropriately here to ensure that the nfs4_client doesn't disappear.
      
      Fixes: 44df6f43
      
       ("NFSD: add delegation reaper to react to low memory condition")
      Reported-by: default avatarVladimir Benes <vbenes@redhat.com>
      Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f7a3090b
    • Arnd Bergmann's avatar
      ata: sata_mv: Fix PCI device ID table declaration compilation warning · 00f75760
      Arnd Bergmann authored
      [ Upstream commit 3137b83a ]
      
      Building with W=1 shows a warning for an unused variable when CONFIG_PCI
      is diabled:
      
      drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable]
      static const struct pci_device_id mv_pci_tbl[] = {
      
      Move the table into the same block that containsn the pci_driver
      definition.
      
      Fixes: 7bb3c529
      
       ("sata_mv: Remove PCI dependency")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      00f75760
    • Arnd Bergmann's avatar
      scsi: mylex: Fix sysfs buffer lengths · e0ad4c27
      Arnd Bergmann authored
      [ Upstream commit 1197c5b2 ]
      
      The myrb and myrs drivers use an odd way of implementing their sysfs files,
      calling snprintf() with a fixed length of 32 bytes to print into a page
      sized buffer. One of the strings is actually longer than 32 bytes, which
      clang can warn about:
      
      drivers/scsi/myrb.c:1906:10: error: 'snprintf' will always be truncated; specified size is 32, but format string expands to at least 34 [-Werror,-Wformat-truncation]
      drivers/scsi/myrs.c:1089:10: error: 'snprintf' will always be truncated; specified size is 32, but format string expands to at least 34 [-Werror,-Wformat-truncation]
      
      These could all be plain sprintf() without a length as the buffer is always
      long enough. On the other hand, sysfs files should not be overly long
      either, so just double the length to make sure the longest strings don't
      get truncated here.
      
      Fixes: 77266186 ("scsi: myrs: Add Mylex RAID controller (SCSI interface)")
      Fixes: 081ff398
      
       ("scsi: myrb: Add Mylex RAID controller (block interface)")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20240326223825.4084412-8-arnd@kernel.org
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e0ad4c27
    • Arnd Bergmann's avatar
      ata: sata_sx4: fix pdc20621_get_from_dimm() on 64-bit · 117d7ef3
      Arnd Bergmann authored
      [ Upstream commit 52f80bb1 ]
      
      gcc warns about a memcpy() with overlapping pointers because of an
      incorrect size calculation:
      
      In file included from include/linux/string.h:369,
                       from drivers/ata/sata_sx4.c:66:
      In function 'memcpy_fromio',
          inlined from 'pdc20621_get_from_dimm.constprop' at drivers/ata/sata_sx4.c:962:2:
      include/linux/fortify-string.h:97:33: error: '__builtin_memcpy' accessing 4294934464 bytes at offsets 0 and [16, 16400] overlaps 6442385281 bytes at offset -2147450817 [-Werror=restrict]
         97 | #define __underlying_memcpy     __builtin_memcpy
            |                                 ^
      include/linux/fortify-string.h:620:9: note: in expansion of macro '__underlying_memcpy'
        620 |         __underlying_##op(p, q, __fortify_size);                        \
            |         ^~~~~~~~~~~~~
      include/linux/fortify-string.h:665:26: note: in expansion of macro '__fortify_memcpy_chk'
        665 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
            |                          ^~~~~~~~~~~~~~~~~~~~
      include/asm-generic/io.h:1184:9: note: in expansion of macro 'memcpy'
       1184 |         memcpy(buffer, __io_virt(addr), size);
            |         ^~~~~~
      
      The problem here is the overflow of an unsigned 32-bit number to a
      negative that gets converted into a signed 'long', keeping a large
      positive number.
      
      Replace the complex calculation with a more readable min() variant
      that avoids the warning.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      117d7ef3
    • Stephen Lee's avatar
      ASoC: ops: Fix wraparound for mask in snd_soc_get_volsw · e9b71370
      Stephen Lee authored
      [ Upstream commit fc563aa9 ]
      
      In snd_soc_info_volsw(), mask is generated by figuring out the index of
      the most significant bit set in max and converting the index to a
      bitmask through bit shift 1. Unintended wraparound occurs when max is an
      integer value with msb bit set. Since the bit shift value 1 is treated
      as an integer type, the left shift operation will wraparound and set
      mask to 0 instead of all 1's. In order to fix this, we type cast 1 as
      `1ULL` to prevent the wraparound.
      
      Fixes: 7077148f
      
       ("ASoC: core: Split ops out of soc-core.c")
      Signed-off-by: default avatarStephen Lee <slee08177@gmail.com>
      Link: https://msgid.link/r/20240326010131.6211-1-slee08177@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e9b71370
    • Pierre-Louis Bossart's avatar
      ASoC: rt711-sdw: fix locking sequence · 562adaf7
      Pierre-Louis Bossart authored
      [ Upstream commit aae86cfd ]
      
      The disable_irq_lock protects the 'disable_irq' value, we need to lock
      before testing it.
      
      Fixes: b69de265
      
       ("ASoC: rt711: fix for JD event handling in ClockStop Mode0")
      Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
      Reviewed-by: default avatarChao Song <chao.song@linux.intel.com>
      Link: https://msgid.link/r/20240325221817.206465-4-pierre-louis.bossart@linux.intel.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      562adaf7
    • Pierre-Louis Bossart's avatar
      ASoC: rt711-sdca: fix locking sequence · bcf894d7
      Pierre-Louis Bossart authored
      [ Upstream commit ee287771 ]
      
      The disable_irq_lock protects the 'disable_irq' value, we need to lock
      before testing it.
      
      Fixes: 23adeb70
      
       ("ASoC: rt711-sdca: fix for JD event handling in ClockStop Mode0")
      Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
      Reviewed-by: default avatarChao Song <chao.song@linux.intel.com>
      Link: https://msgid.link/r/20240325221817.206465-3-pierre-louis.bossart@linux.intel.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bcf894d7
    • Pierre-Louis Bossart's avatar
      ASoC: rt5682-sdw: fix locking sequence · b53cf951
      Pierre-Louis Bossart authored
      [ Upstream commit 310a5caa ]
      
      The disable_irq_lock protects the 'disable_irq' value, we need to lock
      before testing it.
      
      Fixes: 02fb23d7
      
       ("ASoC: rt5682-sdw: fix for JD event handling in ClockStop Mode0")
      Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
      Reviewed-by: default avatarChao Song <chao.song@linux.intel.com>
      Link: https://msgid.link/r/20240325221817.206465-2-pierre-louis.bossart@linux.intel.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b53cf951
    • Paul Barker's avatar
      net: ravb: Always process TX descriptor ring · 9df33e57
      Paul Barker authored
      [ Upstream commit 596a4254 ]
      
      The TX queue should be serviced each time the poll function is called,
      even if the full RX work budget has been consumed. This prevents
      starvation of the TX queue when RX bandwidth usage is high.
      
      Fixes: c156633f
      
       ("Renesas Ethernet AVB driver proper")
      Signed-off-by: default avatarPaul Barker <paul.barker.ct@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Link: https://lore.kernel.org/r/20240402145305.82148-1-paul.barker.ct@bp.renesas.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9df33e57
    • Wei Fang's avatar
      net: fec: Set mac_managed_pm during probe · fcc739d7
      Wei Fang authored
      [ Upstream commit cbc17e78 ]
      
      Setting mac_managed_pm during interface up is too late.
      
      In situations where the link is not brought up yet and the system suspends
      the regular PHY power management will run. Since the FEC ETHEREN control
      bit is cleared (automatically) on suspend the controller is off in resume.
      When the regular PHY power management resume path runs in this context it
      will write to the MII_DATA register but nothing will be transmitted on the
      MDIO bus.
      
      This can be observed by the following log:
      
          fec 5b040000.ethernet eth0: MDIO read timeout
          Microchip LAN87xx T1 5b040000.ethernet-1:04: PM: dpm_run_callback(): mdio_bus_phy_resume+0x0/0xc8 returns -110
          Microchip LAN87xx T1 5b040000.ethernet-1:04: PM: failed to resume: error -110
      
      The data written will however remain in the MII_DATA register.
      
      When the link later is set to administrative up it will trigger a call to
      fec_restart() which will restore the MII_SPEED register. This triggers the
      quirk explained in f166f890 ("net: ethernet: fec: Replace interrupt
      driven MDIO with polled IO") causing an extra MII_EVENT.
      
      This extra event desynchronizes all the MDIO register reads, causing them
      to complete too early. Leading all reads to read as 0 because
      fec_enet_mdio_wait() returns too early.
      
      When a Microchip LAN8700R PHY is connected to the FEC, the 0 reads causes
      the PHY to be initialized incorrectly and the PHY will not transmit any
      ethernet signal in this state. It cannot be brought out of this state
      without a power cycle of the PHY.
      
      Fixes: 557d5dc8
      
       ("net: fec: use mac-managed PHY PM")
      Closes: https://lore.kernel.org/netdev/1f45bdbe-eab1-4e59-8f24-add177590d27@actia.se/
      Signed-off-by: default avatarWei Fang <wei.fang@nxp.com>
      [jernberg: commit message]
      Signed-off-by: default avatarJohn Ernberg <john.ernberg@actia.se>
      Link: https://lore.kernel.org/r/20240328155909.59613-2-john.ernberg@actia.se
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fcc739d7
    • Denis Kirjanov's avatar
      drivers: net: convert to boolean for the mac_managed_pm flag · 498cc233
      Denis Kirjanov authored
      [ Upstream commit eca485d2
      
       ]
      
      Signed-off-by: default avatarDennis Kirjanov <dkirjanov@suse.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: cbc17e78
      
       ("net: fec: Set mac_managed_pm during probe")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      498cc233
    • Oleksij Rempel's avatar
      net: usb: asix: suspend embedded PHY if external is used · 0985fbfb
      Oleksij Rempel authored
      [ Upstream commit 4d17d43d
      
       ]
      
      In case external PHY is used, we need to take care of embedded PHY.
      Since there are no methods to disable this PHY from the MAC side and
      keeping RMII reference clock, we need to suspend it.
      
      This patch will reduce electrical noise (PHY is continuing to send FLPs)
      and power consumption by 0,22W.
      
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: cbc17e78
      
       ("net: fec: Set mac_managed_pm during probe")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0985fbfb
    • Ivan Vecera's avatar
      i40e: Enforce software interrupt during busy-poll exit · 342cb04d
      Ivan Vecera authored
      [ Upstream commit ea558de7 ]
      
      As for ice bug fixed by commit b7306b42 ("ice: manage interrupts
      during poll exit") followed by commit 23be7075 ("ice: fix software
      generating extra interrupts") I'm seeing the similar issue also with
      i40e driver.
      
      In certain situation when busy-loop is enabled together with adaptive
      coalescing, the driver occasionally misses that there are outstanding
      descriptors to clean when exiting busy poll.
      
      Try to catch the remaining work by triggering a software interrupt
      when exiting busy poll. No extra interrupts will be generated when
      busy polling is not used.
      
      The issue was found when running sockperf ping-pong tcp test with
      adaptive coalescing and busy poll enabled (50 as value busy_pool
      and busy_read sysctl knobs) and results in huge latency spikes
      with more than 100000us.
      
      The fix is inspired from the ice driver and do the following:
      1) During napi poll exit in case of busy-poll (napo_complete_done()
         returns false) this is recorded to q_vector that we were in busy
         loop.
      2) Extends i40e_buildreg_itr() to be able to add an enforced software
         interrupt into built value
      2) In i40e_update_enable_itr() enforces a software interrupt trigger
         if we are exiting busy poll to catch any pending clean-ups
      3) Reuses unused 3rd ITR (interrupt throttle) index and set it to
         20K interrupts per second to limit the number of these sw interrupts.
      
      Test results
      ============
      Prior:
      [root@dell-per640-07 net]# sockperf ping-pong -i 10.9.9.1 --tcp -m 1000 --mps=max -t 120
      sockperf: == version #3.10-no.git ==
      sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)
      
      [ 0] IP = 10.9.9.1        PORT = 11111 # TCP
      sockperf: Warmup stage (sending a few dummy messages)...
      sockperf: Starting test...
      sockperf: Test end (interrupted by timer)
      sockperf: Test ended
      sockperf: [Total Run] RunTime=119.999 sec; Warm up time=400 msec; SentMessages=2438563; ReceivedMessages=2438562
      sockperf: ========= Printing statistics for Server No: 0
      sockperf: [Valid Duration] RunTime=119.549 sec; SentMessages=2429473; ReceivedMessages=2429473
      sockperf: ====> avg-latency=24.571 (std-dev=93.297, mean-ad=4.904, median-ad=1.510, siqr=1.063, cv=3.797, std-error=0.060, 99.0% ci=[24.417, 24.725])
      sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
      sockperf: Summary: Latency is 24.571 usec
      sockperf: Total 2429473 observations; each percentile contains 24294.73 observations
      sockperf: ---> <MAX> observation = 103294.331
      sockperf: ---> percentile 99.999 =   45.633
      sockperf: ---> percentile 99.990 =   37.013
      sockperf: ---> percentile 99.900 =   35.910
      sockperf: ---> percentile 99.000 =   33.390
      sockperf: ---> percentile 90.000 =   28.626
      sockperf: ---> percentile 75.000 =   27.741
      sockperf: ---> percentile 50.000 =   26.743
      sockperf: ---> percentile 25.000 =   25.614
      sockperf: ---> <MIN> observation =   12.220
      
      After:
      [root@dell-per640-07 net]# sockperf ping-pong -i 10.9.9.1 --tcp -m 1000 --mps=max -t 120
      sockperf: == version #3.10-no.git ==
      sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s)
      
      [ 0] IP = 10.9.9.1        PORT = 11111 # TCP
      sockperf: Warmup stage (sending a few dummy messages)...
      sockperf: Starting test...
      sockperf: Test end (interrupted by timer)
      sockperf: Test ended
      sockperf: [Total Run] RunTime=119.999 sec; Warm up time=400 msec; SentMessages=2400055; ReceivedMessages=2400054
      sockperf: ========= Printing statistics for Server No: 0
      sockperf: [Valid Duration] RunTime=119.549 sec; SentMessages=2391186; ReceivedMessages=2391186
      sockperf: ====> avg-latency=24.965 (std-dev=5.934, mean-ad=4.642, median-ad=1.485, siqr=1.067, cv=0.238, std-error=0.004, 99.0% ci=[24.955, 24.975])
      sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0
      sockperf: Summary: Latency is 24.965 usec
      sockperf: Total 2391186 observations; each percentile contains 23911.86 observations
      sockperf: ---> <MAX> observation =  195.841
      sockperf: ---> percentile 99.999 =   45.026
      sockperf: ---> percentile 99.990 =   39.009
      sockperf: ---> percentile 99.900 =   35.922
      sockperf: ---> percentile 99.000 =   33.482
      sockperf: ---> percentile 90.000 =   28.902
      sockperf: ---> percentile 75.000 =   27.821
      sockperf: ---> percentile 50.000 =   26.860
      sockperf: ---> percentile 25.000 =   25.685
      sockperf: ---> <MIN> observation =   12.277
      
      Fixes: 0bcd952f
      
       ("ethernet/intel: consolidate NAPI and NAPI exit")
      Reported-by: default avatarHugo Ferreira <hferreir@redhat.com>
      Reviewed-by: default avatarMichal Schmidt <mschmidt@redhat.com>
      Signed-off-by: default avatarIvan Vecera <ivecera@redhat.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@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>
      342cb04d
    • Ivan Vecera's avatar
      i40e: Remove _t suffix from enum type names · c9bcd646
      Ivan Vecera authored
      [ Upstream commit addca917
      
       ]
      
      Enum type names should not be suffixed by '_t'. Either to use
      'typedef enum name name_t' to so plain 'name_t var' instead of
      'enum name_t var'.
      
      Signed-off-by: default avatarIvan Vecera <ivecera@redhat.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Link: https://lore.kernel.org/r/20231113231047.548659-6-anthony.l.nguyen@intel.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Stable-dep-of: ea558de7
      
       ("i40e: Enforce software interrupt during busy-poll exit")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c9bcd646
    • Joe Damato's avatar
      i40e: Store the irq number in i40e_q_vector · 2a0a64c9
      Joe Damato authored
      [ Upstream commit 6b85a4f3
      
       ]
      
      Make it easy to figure out the IRQ number for a particular i40e_q_vector by
      storing the assigned IRQ in the structure itself.
      
      Signed-off-by: default avatarJoe Damato <jdamato@fastly.com>
      Acked-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Acked-by: default avatarSridhar Samudrala <sridhar.samudrala@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>
      Stable-dep-of: ea558de7
      
       ("i40e: Enforce software interrupt during busy-poll exit")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2a0a64c9
    • Alexander Stein's avatar
      Revert "usb: phy: generic: Get the vbus supply" · bf7396ec
      Alexander Stein authored
      [ Upstream commit fdada0db ]
      
      This reverts commit 75fd6485
      
      .
      This patch was applied twice by accident, causing probe failures.
      Revert the accident.
      
      Signed-off-by: default avatarAlexander Stein <alexander.stein@ew.tq-group.com>
      Fixes: 75fd6485
      
       ("usb: phy: generic: Get the vbus supply")
      Cc: stable <stable@kernel.org>
      Reviewed-by: default avatarSean Anderson <sean.anderson@seco.com>
      Link: https://lore.kernel.org/r/20240314092628.1869414-1-alexander.stein@ew.tq-group.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bf7396ec
    • Bikash Hazarika's avatar
      scsi: qla2xxx: Update manufacturer detail · 506a9ec5
      Bikash Hazarika authored
      [ Upstream commit 688fa069
      
       ]
      
      Update manufacturer detail from "Marvell Semiconductor, Inc." to
      "Marvell".
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarBikash Hazarika <bhazarika@marvell.com>
      Signed-off-by: default avatarNilesh Javali <njavali@marvell.com>
      Link: https://lore.kernel.org/r/20240227164127.36465-5-njavali@marvell.com
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      506a9ec5
    • Bikash Hazarika's avatar
      scsi: qla2xxx: Update manufacturer details · 315c4527
      Bikash Hazarika authored
      [ Upstream commit 1ccad277
      
       ]
      
      Update manufacturer details to indicate Marvell Semiconductors.
      
      Link: https://lore.kernel.org/r/20220713052045.10683-10-njavali@marvell.com
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarBikash Hazarika <bhazarika@marvell.com>
      Signed-off-by: default avatarNilesh Javali <njavali@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Stable-dep-of: 688fa069
      
       ("scsi: qla2xxx: Update manufacturer detail")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      315c4527
    • Aleksandr Loktionov's avatar
      i40e: fix vf may be used uninitialized in this function warning · 951d2748
      Aleksandr Loktionov authored
      commit f37c4eac upstream.
      
      To fix the regression introduced by commit 52424f97, which causes
      servers hang in very hard to reproduce conditions with resets races.
      Using two sources for the information is the root cause.
      In this function before the fix bumping v didn't mean bumping vf
      pointer. But the code used this variables interchangeably, so stale vf
      could point to different/not intended vf.
      
      Remove redundant "v" variable and iterate via single VF pointer across
      whole function instead to guarantee VF pointer validity.
      
      Fixes: 52424f97
      
       ("i40e: Fix VF hang when reset is triggered on another VF")
      Signed-off-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
      Reviewed-by: default avatarArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Reviewed-by: default avatarPaul Menzel <pmenzel@molgen.mpg.de>
      Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      951d2748
    • Aleksandr Loktionov's avatar
      i40e: fix i40e_count_filters() to count only active/new filters · 8db472e1
      Aleksandr Loktionov authored
      commit eb58c598 upstream.
      
      The bug usually affects untrusted VFs, because they are limited to 18 MACs,
      it affects them badly, not letting to create MAC all filters.
      Not stable to reproduce, it happens when VF user creates MAC filters
      when other MACVLAN operations are happened in parallel.
      But consequence is that VF can't receive desired traffic.
      
      Fix counter to be bumped only for new or active filters.
      
      Fixes: 621650ca
      
       ("i40e: Refactoring VF MAC filters counting to make more reliable")
      Signed-off-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
      Reviewed-by: default avatarArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
      Reviewed-by: default avatarPaul Menzel <pmenzel@molgen.mpg.de>
      Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8db472e1
    • Su Hui's avatar
      octeontx2-pf: check negative error code in otx2_open() · f53bea1c
      Su Hui authored
      commit e709acbd upstream.
      
      otx2_rxtx_enable() return negative error code such as -EIO,
      check -EIO rather than EIO to fix this problem.
      
      Fixes: c9262522
      
       ("octeontx2-pf: Disable packet I/O for graceful exit")
      Signed-off-by: default avatarSu Hui <suhui@nfschina.com>
      Reviewed-by: default avatarSubbaraya Sundeep <sbhatta@marvell.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Link: https://lore.kernel.org/r/20240328020620.4054692-1-suhui@nfschina.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f53bea1c
    • Hariprasad Kelam's avatar
      octeontx2-af: Fix issue with loading coalesced KPU profiles · ec694ca1
      Hariprasad Kelam authored
      commit 0ba80d96 upstream.
      
      The current implementation for loading coalesced KPU profiles has
      a limitation.  The "offset" field, which is used to locate profiles
      within the profile is restricted to a u16.
      
      This restricts the number of profiles that can be loaded. This patch
      addresses this limitation by increasing the size of the "offset" field.
      
      Fixes: 11c730bf
      
       ("octeontx2-af: support for coalescing KPU profiles")
      Signed-off-by: default avatarHariprasad Kelam <hkelam@marvell.com>
      Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec694ca1
    • Antoine Tenart's avatar
      udp: prevent local UDP tunnel packets from being GROed · 73a328df
      Antoine Tenart authored
      commit 64235eab upstream.
      
      GRO has a fundamental issue with UDP tunnel packets as it can't detect
      those in a foolproof way and GRO could happen before they reach the
      tunnel endpoint. Previous commits have fixed issues when UDP tunnel
      packets come from a remote host, but if those packets are issued locally
      they could run into checksum issues.
      
      If the inner packet has a partial checksum the information will be lost
      in the GRO logic, either in udp4/6_gro_complete or in
      udp_gro_complete_segment and packets will have an invalid checksum when
      leaving the host.
      
      Prevent local UDP tunnel packets from ever being GROed at the outer UDP
      level.
      
      Due to skb->encapsulation being wrongly used in some drivers this is
      actually only preventing UDP tunnel packets with a partial checksum to
      be GROed (see iptunnel_handle_offloads) but those were also the packets
      triggering issues so in practice this should be sufficient.
      
      Fixes: 9fd1ff5d ("udp: Support UDP fraglist GRO/GSO.")
      Fixes: 36707061
      
       ("udp: allow forwarding of plain (non-fraglisted) UDP GRO packets")
      Suggested-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      73a328df
    • Antoine Tenart's avatar
      udp: do not transition UDP GRO fraglist partial checksums to unnecessary · 7223f4ee
      Antoine Tenart authored
      commit f0b8c303 upstream.
      
      UDP GRO validates checksums and in udp4/6_gro_complete fraglist packets
      are converted to CHECKSUM_UNNECESSARY to avoid later checks. However
      this is an issue for CHECKSUM_PARTIAL packets as they can be looped in
      an egress path and then their partial checksums are not fixed.
      
      Different issues can be observed, from invalid checksum on packets to
      traces like:
      
        gen01: hw csum failure
        skb len=3008 headroom=160 headlen=1376 tailroom=0
        mac=(106,14) net=(120,40) trans=160
        shinfo(txflags=0 nr_frags=0 gso(size=0 type=0 segs=0))
        csum(0xffff232e ip_summed=2 complete_sw=0 valid=0 level=0)
        hash(0x77e3d716 sw=1 l4=1) proto=0x86dd pkttype=0 iif=12
        ...
      
      Fix this by only converting CHECKSUM_NONE packets to
      CHECKSUM_UNNECESSARY by reusing __skb_incr_checksum_unnecessary. All
      other checksum types are kept as-is, including CHECKSUM_COMPLETE as
      fraglist packets being segmented back would have their skb->csum valid.
      
      Fixes: 9fd1ff5d
      
       ("udp: Support UDP fraglist GRO/GSO.")
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7223f4ee
    • Antoine Tenart's avatar
      udp: do not accept non-tunnel GSO skbs landing in a tunnel · d49ae15a
      Antoine Tenart authored
      commit 3d010c80 upstream.
      
      When rx-udp-gro-forwarding is enabled UDP packets might be GROed when
      being forwarded. If such packets might land in a tunnel this can cause
      various issues and udp_gro_receive makes sure this isn't the case by
      looking for a matching socket. This is performed in
      udp4/6_gro_lookup_skb but only in the current netns. This is an issue
      with tunneled packets when the endpoint is in another netns. In such
      cases the packets will be GROed at the UDP level, which leads to various
      issues later on. The same thing can happen with rx-gro-list.
      
      We saw this with geneve packets being GROed at the UDP level. In such
      case gso_size is set; later the packet goes through the geneve rx path,
      the geneve header is pulled, the offset are adjusted and frag_list skbs
      are not adjusted with regard to geneve. When those skbs hit
      skb_fragment, it will misbehave. Different outcomes are possible
      depending on what the GROed skbs look like; from corrupted packets to
      kernel crashes.
      
      One example is a BUG_ON[1] triggered in skb_segment while processing the
      frag_list. Because gso_size is wrong (geneve header was pulled)
      skb_segment thinks there is "geneve header size" of data in frag_list,
      although it's in fact the next packet. The BUG_ON itself has nothing to
      do with the issue. This is only one of the potential issues.
      
      Looking up for a matching socket in udp_gro_receive is fragile: the
      lookup could be extended to all netns (not speaking about performances)
      but nothing prevents those packets from being modified in between and we
      could still not find a matching socket. It's OK to keep the current
      logic there as it should cover most cases but we also need to make sure
      we handle tunnel packets being GROed too early.
      
      This is done by extending the checks in udp_unexpected_gso: GSO packets
      lacking the SKB_GSO_UDP_TUNNEL/_CSUM bits and landing in a tunnel must
      be segmented.
      
      [1] kernel BUG at net/core/skbuff.c:4408!
          RIP: 0010:skb_segment+0xd2a/0xf70
          __udp_gso_segment+0xaa/0x560
      
      Fixes: 9fd1ff5d ("udp: Support UDP fraglist GRO/GSO.")
      Fixes: 36707061
      
       ("udp: allow forwarding of plain (non-fraglisted) UDP GRO packets")
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d49ae15a
    • David Thompson's avatar
      mlxbf_gige: stop interface during shutdown · 63a10b53
      David Thompson authored
      commit 09ba28e1 upstream.
      
      The mlxbf_gige driver intermittantly encounters a NULL pointer
      exception while the system is shutting down via "reboot" command.
      The mlxbf_driver will experience an exception right after executing
      its shutdown() method.  One example of this exception is:
      
      Unable to handle kernel NULL pointer dereference at virtual address 0000000000000070
      Mem abort info:
        ESR = 0x0000000096000004
        EC = 0x25: DABT (current EL), IL = 32 bits
        SET = 0, FnV = 0
        EA = 0, S1PTW = 0
        FSC = 0x04: level 0 translation fault
      Data abort info:
        ISV = 0, ISS = 0x00000004
        CM = 0, WnR = 0
      user pgtable: 4k pages, 48-bit VAs, pgdp=000000011d373000
      [0000000000000070] pgd=0000000000000000, p4d=0000000000000000
      Internal error: Oops: 96000004 [#1] SMP
      CPU: 0 PID: 13 Comm: ksoftirqd/0 Tainted: G S         OE     5.15.0-bf.6.gef6992a #1
      Hardware name: https://www.mellanox.com BlueField SoC/BlueField SoC, BIOS 4.0.2.12669 Apr 21 2023
      pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : mlxbf_gige_handle_tx_complete+0xc8/0x170 [mlxbf_gige]
      lr : mlxbf_gige_poll+0x54/0x160 [mlxbf_gige]
      sp : ffff8000080d3c10
      x29: ffff8000080d3c10 x28: ffffcce72cbb7000 x27: ffff8000080d3d58
      x26: ffff0000814e7340 x25: ffff331cd1a05000 x24: ffffcce72c4ea008
      x23: ffff0000814e4b40 x22: ffff0000814e4d10 x21: ffff0000814e4128
      x20: 0000000000000000 x19: ffff0000814e4a80 x18: ffffffffffffffff
      x17: 000000000000001c x16: ffffcce72b4553f4 x15: ffff80008805b8a7
      x14: 0000000000000000 x13: 0000000000000030 x12: 0101010101010101
      x11: 7f7f7f7f7f7f7f7f x10: c2ac898b17576267 x9 : ffffcce720fa5404
      x8 : ffff000080812138 x7 : 0000000000002e9a x6 : 0000000000000080
      x5 : ffff00008de3b000 x4 : 0000000000000000 x3 : 0000000000000001
      x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
      Call trace:
       mlxbf_gige_handle_tx_complete+0xc8/0x170 [mlxbf_gige]
       mlxbf_gige_poll+0x54/0x160 [mlxbf_gige]
       __napi_poll+0x40/0x1c8
       net_rx_action+0x314/0x3a0
       __do_softirq+0x128/0x334
       run_ksoftirqd+0x54/0x6c
       smpboot_thread_fn+0x14c/0x190
       kthread+0x10c/0x110
       ret_from_fork+0x10/0x20
      Code: 8b070000 f9000ea0 f95056c0 f86178a1 (b9407002)
      ---[ end trace 7cc3941aa0d8e6a4 ]---
      Kernel panic - not syncing: Oops: Fatal exception in interrupt
      Kernel Offset: 0x4ce722520000 from 0xffff800008000000
      PHYS_OFFSET: 0x80000000
      CPU features: 0x000005c1,a3330e5a
      Memory Limit: none
      ---[ end Kernel panic - not syncing: Oops: Fatal exception in interrupt ]---
      
      During system shutdown, the mlxbf_gige driver's shutdown() is always executed.
      However, the driver's stop() method will only execute if networking interface
      configuration logic within the Linux distribution has been setup to do so.
      
      If shutdown() executes but stop() does not execute, NAPI remains enabled
      and this can lead to an exception if NAPI is scheduled while the hardware
      interface has only been partially deinitialized.
      
      The networking interface managed by the mlxbf_gige driver must be properly
      stopped during system shutdown so that IFF_UP is cleared, the hardware
      interface is put into a clean state, and NAPI is fully deinitialized.
      
      Fixes: f92e1869
      
       ("Add Mellanox BlueField Gigabit Ethernet driver")
      Signed-off-by: default avatarDavid Thompson <davthompson@nvidia.com>
      Link: https://lore.kernel.org/r/20240325210929.25362-1-davthompson@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      63a10b53
    • Kuniyuki Iwashima's avatar
      ipv6: Fix infinite recursion in fib6_dump_done(). · 40a344b2
      Kuniyuki Iwashima authored
      commit d21d4060 upstream.
      
      syzkaller reported infinite recursive calls of fib6_dump_done() during
      netlink socket destruction.  [1]
      
      From the log, syzkaller sent an AF_UNSPEC RTM_GETROUTE message, and then
      the response was generated.  The following recvmmsg() resumed the dump
      for IPv6, but the first call of inet6_dump_fib() failed at kzalloc() due
      to the fault injection.  [0]
      
        12:01:34 executing program 3:
        r0 = socket$nl_route(0x10, 0x3, 0x0)
        sendmsg$nl_route(r0, ... snip ...)
        recvmmsg(r0, ... snip ...) (fail_nth: 8)
      
      Here, fib6_dump_done() was set to nlk_sk(sk)->cb.done, and the next call
      of inet6_dump_fib() set it to nlk_sk(sk)->cb.args[3].  syzkaller stopped
      receiving the response halfway through, and finally netlink_sock_destruct()
      called nlk_sk(sk)->cb.done().
      
      fib6_dump_done() calls fib6_dump_end() and nlk_sk(sk)->cb.done() if it
      is still not NULL.  fib6_dump_end() rewrites nlk_sk(sk)->cb.done() by
      nlk_sk(sk)->cb.args[3], but it has the same function, not NULL, calling
      itself recursively and hitting the stack guard page.
      
      To avoid the issue, let's set the destructor after kzalloc().
      
      [0]:
      FAULT_INJECTION: forcing a failure.
      name failslab, interval 1, probability 0, space 0, times 0
      CPU: 1 PID: 432110 Comm: syz-executor.3 Not tainted 6.8.0-12821-g537c2e91d354-dirty #11
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
      Call Trace:
       <TASK>
       dump_stack_lvl (lib/dump_stack.c:117)
       should_fail_ex (lib/fault-inject.c:52 lib/fault-inject.c:153)
       should_failslab (mm/slub.c:3733)
       kmalloc_trace (mm/slub.c:3748 mm/slub.c:3827 mm/slub.c:3992)
       inet6_dump_fib (./include/linux/slab.h:628 ./include/linux/slab.h:749 net/ipv6/ip6_fib.c:662)
       rtnl_dump_all (net/core/rtnetlink.c:4029)
       netlink_dump (net/netlink/af_netlink.c:2269)
       netlink_recvmsg (net/netlink/af_netlink.c:1988)
       ____sys_recvmsg (net/socket.c:1046 net/socket.c:2801)
       ___sys_recvmsg (net/socket.c:2846)
       do_recvmmsg (net/socket.c:2943)
       __x64_sys_recvmmsg (net/socket.c:3041 net/socket.c:3034 net/socket.c:3034)
      
      [1]:
      BUG: TASK stack guard page was hit at 00000000f2fa9af1 (stack is 00000000b7912430..000000009a436beb)
      stack guard page: 0000 [#1] PREEMPT SMP KASAN
      CPU: 1 PID: 223719 Comm: kworker/1:3 Not tainted 6.8.0-12821-g537c2e91d354-dirty #11
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
      Workqueue: events netlink_sock_destruct_work
      RIP: 0010:fib6_dump_done (net/ipv6/ip6_fib.c:570)
      Code: 3c 24 e8 f3 e9 51 fd e9 28 fd ff ff 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 41 57 41 56 41 55 41 54 55 48 89 fd <53> 48 8d 5d 60 e8 b6 4d 07 fd 48 89 da 48 b8 00 00 00 00 00 fc ff
      RSP: 0018:ffffc9000d980000 EFLAGS: 00010293
      RAX: 0000000000000000 RBX: ffffffff84405990 RCX: ffffffff844059d3
      RDX: ffff8881028e0000 RSI: ffffffff84405ac2 RDI: ffff88810c02f358
      RBP: ffff88810c02f358 R08: 0000000000000007 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000224 R12: 0000000000000000
      R13: ffff888007c82c78 R14: ffff888007c82c68 R15: ffff888007c82c68
      FS:  0000000000000000(0000) GS:ffff88811b100000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: ffffc9000d97fff8 CR3: 0000000102309002 CR4: 0000000000770ef0
      PKRU: 55555554
      Call Trace:
       <#DF>
       </#DF>
       <TASK>
       fib6_dump_done (net/ipv6/ip6_fib.c:572 (discriminator 1))
       fib6_dump_done (net/ipv6/ip6_fib.c:572 (discriminator 1))
       ...
       fib6_dump_done (net/ipv6/ip6_fib.c:572 (discriminator 1))
       fib6_dump_done (net/ipv6/ip6_fib.c:572 (discriminator 1))
       netlink_sock_destruct (net/netlink/af_netlink.c:401)
       __sk_destruct (net/core/sock.c:2177 (discriminator 2))
       sk_destruct (net/core/sock.c:2224)
       __sk_free (net/core/sock.c:2235)
       sk_free (net/core/sock.c:2246)
       process_one_work (kernel/workqueue.c:3259)
       worker_thread (kernel/workqueue.c:3329 kernel/workqueue.c:3416)
       kthread (kernel/kthread.c:388)
       ret_from_fork (arch/x86/kernel/process.c:153)
       ret_from_fork_asm (arch/x86/entry/entry_64.S:256)
      Modules linked in:
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20240401211003.25274-1-kuniyu@amazon.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      40a344b2
    • Jakub Kicinski's avatar
      selftests: reuseaddr_conflict: add missing new line at the end of the output · 61f5b43b
      Jakub Kicinski authored
      commit 31974122 upstream.
      
      The netdev CI runs in a VM and captures serial, so stdout and
      stderr get combined. Because there's a missing new line in
      stderr the test ends up corrupting KTAP:
      
        # Successok 1 selftests: net: reuseaddr_conflict
      
      which should have been:
      
        # Success
        ok 1 selftests: net: reuseaddr_conflict
      
      Fixes: 422d8dc6
      
       ("selftest: add a reuseaddr test")
      Reviewed-by: default avatarMuhammad Usama Anjum <usama.anjum@collabora.com>
      Link: https://lore.kernel.org/r/20240329160559.249476-1-kuba@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      61f5b43b
    • Eric Dumazet's avatar
      erspan: make sure erspan_base_hdr is present in skb->head · ee008810
      Eric Dumazet authored
      commit 17af4205 upstream.
      
      syzbot reported a problem in ip6erspan_rcv() [1]
      
      Issue is that ip6erspan_rcv() (and erspan_rcv()) no longer make
      sure erspan_base_hdr is present in skb linear part (skb->head)
      before getting @ver field from it.
      
      Add the missing pskb_may_pull() calls.
      
      v2: Reload iph pointer in erspan_rcv() after pskb_may_pull()
          because skb->head might have changed.
      
      [1]
      
       BUG: KMSAN: uninit-value in pskb_may_pull_reason include/linux/skbuff.h:2742 [inline]
       BUG: KMSAN: uninit-value in pskb_may_pull include/linux/skbuff.h:2756 [inline]
       BUG: KMSAN: uninit-value in ip6erspan_rcv net/ipv6/ip6_gre.c:541 [inline]
       BUG: KMSAN: uninit-value in gre_rcv+0x11f8/0x1930 net/ipv6/ip6_gre.c:610
        pskb_may_pull_reason include/linux/skbuff.h:2742 [inline]
        pskb_may_pull include/linux/skbuff.h:2756 [inline]
        ip6erspan_rcv net/ipv6/ip6_gre.c:541 [inline]
        gre_rcv+0x11f8/0x1930 net/ipv6/ip6_gre.c:610
        ip6_protocol_deliver_rcu+0x1d4c/0x2ca0 net/ipv6/ip6_input.c:438
        ip6_input_finish net/ipv6/ip6_input.c:483 [inline]
        NF_HOOK include/linux/netfilter.h:314 [inline]
        ip6_input+0x15d/0x430 net/ipv6/ip6_input.c:492
        ip6_mc_input+0xa7e/0xc80 net/ipv6/ip6_input.c:586
        dst_input include/net/dst.h:460 [inline]
        ip6_rcv_finish+0x955/0x970 net/ipv6/ip6_input.c:79
        NF_HOOK include/linux/netfilter.h:314 [inline]
        ipv6_rcv+0xde/0x390 net/ipv6/ip6_input.c:310
        __netif_receive_skb_one_core net/core/dev.c:5538 [inline]
        __netif_receive_skb+0x1da/0xa00 net/core/dev.c:5652
        netif_receive_skb_internal net/core/dev.c:5738 [inline]
        netif_receive_skb+0x58/0x660 net/core/dev.c:5798
        tun_rx_batched+0x3ee/0x980 drivers/net/tun.c:1549
        tun_get_user+0x5566/0x69e0 drivers/net/tun.c:2002
        tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2048
        call_write_iter include/linux/fs.h:2108 [inline]
        new_sync_write fs/read_write.c:497 [inline]
        vfs_write+0xb63/0x1520 fs/read_write.c:590
        ksys_write+0x20f/0x4c0 fs/read_write.c:643
        __do_sys_write fs/read_write.c:655 [inline]
        __se_sys_write fs/read_write.c:652 [inline]
        __x64_sys_write+0x93/0xe0 fs/read_write.c:652
       do_syscall_64+0xd5/0x1f0
       entry_SYSCALL_64_after_hwframe+0x6d/0x75
      
      Uninit was created at:
        slab_post_alloc_hook mm/slub.c:3804 [inline]
        slab_alloc_node mm/slub.c:3845 [inline]
        kmem_cache_alloc_node+0x613/0xc50 mm/slub.c:3888
        kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:577
        __alloc_skb+0x35b/0x7a0 net/core/skbuff.c:668
        alloc_skb include/linux/skbuff.h:1318 [inline]
        alloc_skb_with_frags+0xc8/0xbf0 net/core/skbuff.c:6504
        sock_alloc_send_pskb+0xa81/0xbf0 net/core/sock.c:2795
        tun_alloc_skb drivers/net/tun.c:1525 [inline]
        tun_get_user+0x209a/0x69e0 drivers/net/tun.c:1846
        tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2048
        call_write_iter include/linux/fs.h:2108 [inline]
        new_sync_write fs/read_write.c:497 [inline]
        vfs_write+0xb63/0x1520 fs/read_write.c:590
        ksys_write+0x20f/0x4c0 fs/read_write.c:643
        __do_sys_write fs/read_write.c:655 [inline]
        __se_sys_write fs/read_write.c:652 [inline]
        __x64_sys_write+0x93/0xe0 fs/read_write.c:652
       do_syscall_64+0xd5/0x1f0
       entry_SYSCALL_64_after_hwframe+0x6d/0x75
      
      CPU: 1 PID: 5045 Comm: syz-executor114 Not tainted 6.9.0-rc1-syzkaller-00021-g962490525cff #0
      
      Fixes: cb73ee40
      
       ("net: ip_gre: use erspan key field for tunnel lookup")
      Reported-by: default avatar <syzbot+1c1cf138518bf0c53d68@syzkaller.appspotmail.com>
      Closes: https://lore.kernel.org/netdev/000000000000772f2c0614b66ef7@google.com/
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Lorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/20240328112248.1101491-1-edumazet@google.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ee008810
    • Antoine Tenart's avatar
      selftests: net: gro fwd: update vxlan GRO test expectations · 3f9a8b79
      Antoine Tenart authored
      commit 0fb101be upstream.
      
      UDP tunnel packets can't be GRO in-between their endpoints as this
      causes different issues. The UDP GRO fwd vxlan tests were relying on
      this and their expectations have to be fixed.
      
      We keep both vxlan tests and expected no GRO from happening. The vxlan
      UDP GRO bench test was removed as it's not providing any valuable
      information now.
      
      Fixes: a062260a
      
       ("selftests: net: add UDP GRO forwarding self-tests")
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3f9a8b79
    • Piotr Wejman's avatar
      net: stmmac: fix rx queue priority assignment · 457c832a
      Piotr Wejman authored
      commit b3da86d4 upstream.
      
      The driver should ensure that same priority is not mapped to multiple
      rx queues. From DesignWare Cores Ethernet Quality-of-Service
      Databook, section 17.1.29 MAC_RxQ_Ctrl2:
      "[...]The software must ensure that the content of this field is
      mutually exclusive to the PSRQ fields for other queues, that is,
      the same priority is not mapped to multiple Rx queues[...]"
      
      Previously rx_queue_priority() function was:
      - clearing all priorities from a queue
      - adding new priorities to that queue
      After this patch it will:
      - first assign new priorities to a queue
      - then remove those priorities from all other queues
      - keep other priorities previously assigned to that queue
      
      Fixes: a8f5102a ("net: stmmac: TX and RX queue priority configuration")
      Fixes: 2142754f
      
       ("net: stmmac: Add MAC related callbacks for XGMAC2")
      Signed-off-by: default avatarPiotr Wejman <piotrwejman90@gmail.com>
      Link: https://lore.kernel.org/r/20240401192239.33942-1-piotrwejman90@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      457c832a