Skip to content
  1. Jun 12, 2024
    • Yue Haibing's avatar
      ipvlan: Dont Use skb->sk in ipvlan_process_v{4,6}_outbound · 54213c09
      Yue Haibing authored
      [ Upstream commit b3dc6e80 ]
      
      Raw packet from PF_PACKET socket ontop of an IPv6-backed ipvlan device will
      hit WARN_ON_ONCE() in sk_mc_loop() through sch_direct_xmit() path.
      
      WARNING: CPU: 2 PID: 0 at net/core/sock.c:775 sk_mc_loop+0x2d/0x70
      Modules linked in: sch_netem ipvlan rfkill cirrus drm_shmem_helper sg drm_kms_helper
      CPU: 2 PID: 0 Comm: swapper/2 Kdump: loaded Not tainted 6.9.0+ #279
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
      RIP: 0010:sk_mc_loop+0x2d/0x70
      Code: fa 0f 1f 44 00 00 65 0f b7 15 f7 96 a3 4f 31 c0 66 85 d2 75 26 48 85 ff 74 1c
      RSP: 0018:ffffa9584015cd78 EFLAGS: 00010212
      RAX: 0000000000000011 RBX: ffff91e585793e00 RCX: 0000000002c6a001
      RDX: 0000000000000000 RSI: 0000000000000040 RDI: ffff91e589c0f000
      RBP: ffff91e5855bd100 R08: 0000000000000000 R09: 3d00545216f43d00
      R10: ffff91e584fdcc50 R11: 00000060dd8616f4 R12: ffff91e58132d000
      R13: ffff91e584fdcc68 R14: ffff91e5869ce800 R15: ffff91e589c0f000
      FS:  0000000000000000(0000) GS:ffff91e898100000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f788f7c44c0 CR3: 0000000008e1a000 CR4: 00000000000006f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
      <IRQ>
       ? __warn (kernel/panic.c:693)
       ? sk_mc_loop (net/core/sock.c:760)
       ? report_bug (lib/bug.c:201 lib/bug.c:219)
       ? handle_bug (arch/x86/kernel/traps.c:239)
       ? exc_invalid_op (arch/x86/kernel/traps.c:260 (discriminator 1))
       ? asm_exc_invalid_op (./arch/x86/include/asm/idtentry.h:621)
       ? sk_mc_loop (net/core/sock.c:760)
       ip6_finish_output2 (net/ipv6/ip6_output.c:83 (discriminator 1))
       ? nf_hook_slow (net/netfilter/core.c:626)
       ip6_finish_output (net/ipv6/ip6_output.c:222)
       ? __pfx_ip6_finish_output (net/ipv6/ip6_output.c:215)
       ipvlan_xmit_mode_l3 (drivers/net/ipvlan/ipvlan_core.c:602) ipvlan
       ipvlan_start_xmit (drivers/net/ipvlan/ipvlan_main.c:226) ipvlan
       dev_hard_start_xmit (net/core/dev.c:3594)
       sch_direct_xmit (net/sched/sch_generic.c:343)
       __qdisc_run (net/sched/sch_generic.c:416)
       net_tx_action (net/core/dev.c:5286)
       handle_softirqs (kernel/softirq.c:555)
       __irq_exit_rcu (kernel/softirq.c:589)
       sysvec_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:1043)
      
      The warning triggers as this:
      packet_sendmsg
         packet_snd //skb->sk is packet sk
            __dev_queue_xmit
               __dev_xmit_skb //q->enqueue is not NULL
                   __qdisc_run
                     sch_direct_xmit
                       dev_hard_start_xmit
                         ipvlan_start_xmit
                            ipvlan_xmit_mode_l3 //l3 mode
                              ipvlan_process_outbound //vepa flag
                                ipvlan_process_v6_outbound
                                  ip6_local_out
                                      __ip6_finish_output
                                        ip6_finish_output2 //multicast packet
                                          sk_mc_loop //sk->sk_family is AF_PACKET
      
      Call ip{6}_local_out() with NULL sk in ipvlan as other tunnels to fix this.
      
      Fixes: 2ad7bf36
      
       ("ipvlan: Initial check-in of the IPVLAN driver.")
      Suggested-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarYue Haibing <yuehaibing@huawei.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20240529095633.613103-1-yuehaibing@huawei.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      54213c09
    • Shay Agroskin's avatar
      net: ena: Fix redundant device NUMA node override · 659ef6fd
      Shay Agroskin authored
      [ Upstream commit 2dc8b1e7 ]
      
      The driver overrides the NUMA node id of the device regardless of
      whether it knows its correct value (often setting it to -1 even though
      the node id is advertised in 'struct device'). This can lead to
      suboptimal configurations.
      
      This patch fixes this behavior and makes the shared memory allocation
      functions use the NUMA node id advertised by the underlying device.
      
      Fixes: 1738cd3e
      
       ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
      Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
      Link: https://lore.kernel.org/r/20240528170912.1204417-1-shayagr@amazon.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      659ef6fd
    • David Arinzon's avatar
      net: ena: Reduce lines with longer column width boundary · 26668c2d
      David Arinzon authored
      [ Upstream commit 50613650
      
       ]
      
      This patch reduces some of the lines by removing newlines
      where more variables or print strings can be pushed back
      to the previous line while still adhering to the styling
      guidelines.
      
      Signed-off-by: default avatarDavid Arinzon <darinzon@amazon.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Stable-dep-of: 2dc8b1e7
      
       ("net: ena: Fix redundant device NUMA node override")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      26668c2d
    • Tristram Ha's avatar
      net: dsa: microchip: fix RGMII error in KSZ DSA driver · f826701d
      Tristram Ha authored
      [ Upstream commit 278d65cc ]
      
      The driver should return RMII interface when XMII is running in RMII mode.
      
      Fixes: 0ab7f6bf
      
       ("net: dsa: microchip: ksz9477: use common xmii function")
      Signed-off-by: default avatarTristram Ha <tristram.ha@microchip.com>
      Acked-by: default avatarArun Ramadoss <arun.ramadoss@microchip.com>
      Acked-by: default avatarJerry Ray <jerry.ray@microchip.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/1716932066-3342-1-git-send-email-Tristram.Ha@microchip.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f826701d
    • Uwe Kleine-König's avatar
      spi: stm32: Don't warn about spurious interrupts · 2c2e3247
      Uwe Kleine-König authored
      [ Upstream commit 95d7c452 ]
      
      The dev_warn to notify about a spurious interrupt was introduced with
      the reasoning that these are unexpected. However spurious interrupts
      tend to trigger continously and the error message on the serial console
      prevents that the core's detection of spurious interrupts kicks in
      (which disables the irq) and just floods the console.
      
      Fixes: c64e7efe
      
       ("spi: stm32: make spurious and overrun interrupts visible")
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Link: https://msgid.link/r/20240521105241.62400-2-u.kleine-koenig@pengutronix.de
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2c2e3247
    • Miguel Ojeda's avatar
      kheaders: use `command -v` to test for existence of `cpio` · db931285
      Miguel Ojeda authored
      [ Upstream commit 6e58e017 ]
      
      Commit 13e1df09 ("kheaders: explicitly validate existence of cpio
      command") added an explicit check for `cpio` using `type`.
      
      However, `type` in `dash` (which is used in some popular distributions
      and base images as the shell script runner) prints the missing message
      to standard output, and thus no error is printed:
      
          $ bash -c 'type missing >/dev/null'
          bash: line 1: type: missing: not found
          $ dash -c 'type missing >/dev/null'
          $
      
      For instance, this issue may be seen by loongarch builders, given its
      defconfig enables CONFIG_IKHEADERS since commit 9cc1df42 ("LoongArch:
      Update Loongson-3 default config file").
      
      Therefore, use `command -v` instead to have consistent behavior, and
      take the chance to provide a more explicit error.
      
      Fixes: 13e1df09
      
       ("kheaders: explicitly validate existence of cpio command")
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      db931285
    • Andi Shyti's avatar
      drm/i915/gt: Fix CCS id's calculation for CCS mode setting · 0b01a41e
      Andi Shyti authored
      [ Upstream commit ee01b6a3 ]
      
      The whole point of the previous fixes has been to change the CCS
      hardware configuration to generate only one stream available to
      the compute users. We did this by changing the info.engine_mask
      that is set during device probe, reset during the detection of
      the fused engines, and finally reset again when choosing the CCS
      mode.
      
      We can't use the engine_mask variable anymore, as with the
      current configuration, it imposes only one CCS no matter what the
      hardware configuration is.
      
      Before changing the engine_mask for the third time, save it and
      use it for calculating the CCS mode.
      
      After the previous changes, the user reported a performance drop
      to around 1/4. We have tested that the compute operations, with
      the current patch, have improved by the same factor.
      
      Fixes: 6db31251
      
       ("drm/i915/gt: Enable only one CCS for compute workload")
      Signed-off-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
      Cc: Chris Wilson <chris.p.wilson@linux.intel.com>
      Cc: Gnattu OC <gnattuoc@me.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Tested-by: default avatarJian Ye <jian.ye@intel.com>
      Reviewed-by: default avatarUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
      Tested-by: default avatarGnattu OC <gnattuoc@me.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240517090616.242529-1-andi.shyti@linux.intel.com
      (cherry picked from commit a09d2327
      
      )
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0b01a41e
    • Arnd Bergmann's avatar
      drm/i915/guc: avoid FIELD_PREP warning · d154613d
      Arnd Bergmann authored
      [ Upstream commit d4f36db6 ]
      
      With gcc-7 and earlier, there are lots of warnings like
      
      In file included from <command-line>:0:0:
      In function '__guc_context_policy_add_priority.isra.66',
          inlined from '__guc_context_set_prio.isra.67' at drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:3292:3,
          inlined from 'guc_context_set_prio' at drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:3320:2:
      include/linux/compiler_types.h:399:38: error: call to '__compiletime_assert_631' declared with attribute error: FIELD_PREP: mask is not constant
        _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
                                            ^
      ...
      drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2422:3: note: in expansion of macro 'FIELD_PREP'
         FIELD_PREP(GUC_KLV_0_KEY, GUC_CONTEXT_POLICIES_KLV_ID_##id) | \
         ^~~~~~~~~~
      
      Make sure that GUC_KLV_0_KEY is an unsigned value to avoid the warning.
      
      Fixes: 77b6f79d
      
       ("drm/i915/guc: Update to GuC version 69.0.3")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
      Signed-off-by: default avatarJulia Filipchuk <julia.filipchuk@intel.com>
      Signed-off-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240430164809.482131-1-julia.filipchuk@intel.com
      (cherry picked from commit 364e0398
      
      )
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d154613d
    • Masahiro Yamada's avatar
      kconfig: fix comparison to constant symbols, 'm', 'n' · 2b6e818f
      Masahiro Yamada authored
      [ Upstream commit aabdc960 ]
      
      Currently, comparisons to 'm' or 'n' result in incorrect output.
      
      [Test Code]
      
          config MODULES
                  def_bool y
                  modules
      
          config A
                  def_tristate m
      
          config B
                  def_bool A > n
      
      CONFIG_B is unset, while CONFIG_B=y is expected.
      
      The reason for the issue is because Kconfig compares the tristate values
      as strings.
      
      Currently, the .type fields in the constant symbol definitions,
      symbol_{yes,mod,no} are unspecified, i.e., S_UNKNOWN.
      
      When expr_calc_value() evaluates 'A > n', it checks the types of 'A' and
      'n' to determine how to compare them.
      
      The left-hand side, 'A', is a tristate symbol with a value of 'm', which
      corresponds to a numeric value of 1. (Internally, 'y', 'm', and 'n' are
      represented as 2, 1, and 0, respectively.)
      
      The right-hand side, 'n', has an unknown type, so it is treated as the
      string "n" during the comparison.
      
      expr_calc_value() compares two values numerically only when both can
      have numeric values. Otherwise, they are compared as strings.
      
          symbol    numeric value    ASCII code
          -------------------------------------
            y           2             0x79
            m           1             0x6d
            n           0             0x6e
      
      'm' is greater than 'n' if compared numerically (since 1 is greater
      than 0), but smaller than 'n' if compared as strings (since the ASCII
      code 0x6d is smaller than 0x6e).
      
      Specifying .type=S_TRISTATE for symbol_{yes,mod,no} fixes the above
      test code.
      
      Doing so, however, would cause a regression to the following test code.
      
      [Test Code 2]
      
          config MODULES
                  def_bool n
                  modules
      
          config A
                  def_tristate n
      
          config B
                  def_bool A = m
      
      You would get CONFIG_B=y, while CONFIG_B should not be set.
      
      The reason is because sym_get_string_value() turns 'm' into 'n' when the
      module feature is disabled. Consequently, expr_calc_value() evaluates
      'A = n' instead of 'A = m'. This oddity has been hidden because the type
      of 'm' was previously S_UNKNOWN instead of S_TRISTATE.
      
      sym_get_string_value() should not tweak the string because the tristate
      value has already been correctly calculated. There is no reason to
      return the string "n" where its tristate value is mod.
      
      Fixes: 31847b67
      
       ("kconfig: allow use of relations other than (in)equality")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2b6e818f
    • Vladimir Oltean's avatar
      net/sched: taprio: extend minimum interval restriction to entire cycle too · b939d1e0
      Vladimir Oltean authored
      [ Upstream commit fb66df20 ]
      
      It is possible for syzbot to side-step the restriction imposed by the
      blamed commit in the Fixes: tag, because the taprio UAPI permits a
      cycle-time different from (and potentially shorter than) the sum of
      entry intervals.
      
      We need one more restriction, which is that the cycle time itself must
      be larger than N * ETH_ZLEN bit times, where N is the number of schedule
      entries. This restriction needs to apply regardless of whether the cycle
      time came from the user or was the implicit, auto-calculated value, so
      we move the existing "cycle == 0" check outside the "if "(!new->cycle_time)"
      branch. This way covers both conditions and scenarios.
      
      Add a selftest which illustrates the issue triggered by syzbot.
      
      Fixes: b5b73b26
      
       ("taprio: Fix allowing too small intervals")
      Reported-by: default avatar <syzbot+a7d2b1d5d1af83035567@syzkaller.appspotmail.com>
      Closes: https://lore.kernel.org/netdev/0000000000007d66bc06196e7c66@google.com/
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://lore.kernel.org/r/20240527153955.553333-2-vladimir.oltean@nxp.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b939d1e0
    • Vladimir Oltean's avatar
      net/sched: taprio: make q->picos_per_byte available to fill_sched_entry() · aa311596
      Vladimir Oltean authored
      [ Upstream commit e6341341 ]
      
      In commit b5b73b26 ("taprio: Fix allowing too small intervals"), a
      comparison of user input against length_to_duration(q, ETH_ZLEN) was
      introduced, to avoid RCU stalls due to frequent hrtimers.
      
      The implementation of length_to_duration() depends on q->picos_per_byte
      being set for the link speed. The blamed commit in the Fixes: tag has
      moved this too late, so the checks introduced above are ineffective.
      The q->picos_per_byte is zero at parse_taprio_schedule() ->
      parse_sched_list() -> parse_sched_entry() -> fill_sched_entry() time.
      
      Move the taprio_set_picos_per_byte() call as one of the first things in
      taprio_change(), before the bulk of the netlink attribute parsing is
      done. That's because it is needed there.
      
      Add a selftest to make sure the issue doesn't get reintroduced.
      
      Fixes: 09dbdf28
      
       ("net/sched: taprio: fix calculation of maximum gate durations")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20240527153955.553333-1-vladimir.oltean@nxp.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      aa311596
    • Eric Garver's avatar
      netfilter: nft_fib: allow from forward/input without iif selector · 61134e41
      Eric Garver authored
      [ Upstream commit e8ded22e ]
      
      This removes the restriction of needing iif selector in the
      forward/input hooks for fib lookups when requested result is
      oif/oifname.
      
      Removing this restriction allows "loose" lookups from the forward hooks.
      
      Fixes: be8be04e
      
       ("netfilter: nft_fib: reverse path filter for policy-based routing on iif")
      Signed-off-by: default avatarEric Garver <eric@garver.life>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      61134e41
    • Florian Westphal's avatar
      netfilter: tproxy: bail out if IP has been disabled on the device · 570b4c52
      Florian Westphal authored
      [ Upstream commit 21a673bd
      
       ]
      
      syzbot reports:
      general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN PTI
      KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
      [..]
      RIP: 0010:nf_tproxy_laddr4+0xb7/0x340 net/ipv4/netfilter/nf_tproxy_ipv4.c:62
      Call Trace:
       nft_tproxy_eval_v4 net/netfilter/nft_tproxy.c:56 [inline]
       nft_tproxy_eval+0xa9a/0x1a00 net/netfilter/nft_tproxy.c:168
      
      __in_dev_get_rcu() can return NULL, so check for this.
      
      Reported-and-tested-by: default avatar <syzbot+b94a6818504ea90d7661@syzkaller.appspotmail.com>
      Fixes: cc6eb433
      
       ("tproxy: use the interface primary IP address as a default value for --on-ip")
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      570b4c52
    • Pablo Neira Ayuso's avatar
      netfilter: nft_payload: skbuff vlan metadata mangle support · c4f77480
      Pablo Neira Ayuso authored
      [ Upstream commit 33c563eb ]
      
      Userspace assumes vlan header is present at a given offset, but vlan
      offload allows to store this in metadata fields of the skbuff. Hence
      mangling vlan results in a garbled packet. Handle this transparently by
      adding a parser to the kernel.
      
      If vlan metadata is present and payload offset is over 12 bytes (source
      and destination mac address fields), then subtract vlan header present
      in vlan metadata, otherwise mangle vlan metadata based on offset and
      length, extracting data from the source register.
      
      This is similar to:
      
        8cfd23e6 ("netfilter: nft_payload: work around vlan header stripping")
      
      to deal with vlan payload mangling.
      
      Fixes: 7ec3f7b4
      
       ("netfilter: nft_payload: add packet mangling support")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c4f77480
    • MD Danish Anwar's avatar
      net: ti: icssg-prueth: Fix start counter for ft1 filter · 75bc6bc5
      MD Danish Anwar authored
      [ Upstream commit 56a5cf53 ]
      
      The start counter for FT1 filter is wrongly set to 0 in the driver.
      FT1 is used for source address violation (SAV) check and source address
      starts at Byte 6 not Byte 0. Fix this by changing start counter to
      ETH_ALEN in icssg_ft1_set_mac_addr().
      
      Fixes: e9b4ece7
      
       ("net: ti: icssg-prueth: Add Firmware config and classification APIs.")
      Signed-off-by: default avatarMD Danish Anwar <danishanwar@ti.com>
      Link: https://lore.kernel.org/r/20240527063015.263748-1-danishanwar@ti.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      75bc6bc5
    • Takashi Iwai's avatar
      ALSA: seq: Don't clear bank selection at event -> UMP MIDI2 conversion · 4448b5ea
      Takashi Iwai authored
      [ Upstream commit a200df7d ]
      
      The current code to convert from a legacy sequencer event to UMP MIDI2
      clears the bank selection at each time the program change is
      submitted.  This is confusing and may lead to incorrect bank values
      tranmitted to the destination in the end.
      
      Drop the line to clear the bank info and keep the provided values.
      
      Fixes: e9e02819
      
       ("ALSA: seq: Automatic conversion of UMP events")
      Link: https://lore.kernel.org/r/20240527151852.29036-2-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4448b5ea
    • Takashi Iwai's avatar
      ALSA: seq: Fix missing bank setup between MIDI1/MIDI2 UMP conversion · 5c3df8c4
      Takashi Iwai authored
      [ Upstream commit 8a42886c ]
      
      When a UMP packet is converted between MIDI1 and MIDI2 protocols, the
      bank selection may be lost.  The conversion from MIDI1 to MIDI2 needs
      the encoding of the bank into UMP_MSG_STATUS_PROGRAM bits, while the
      conversion from MIDI2 to MIDI1 needs the extraction from that
      instead.
      
      This patch implements the missing bank selection mechanism in those
      conversions.
      
      Fixes: e9e02819
      
       ("ALSA: seq: Automatic conversion of UMP events")
      Link: https://lore.kernel.org/r/20240527151852.29036-1-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5c3df8c4
    • Matthieu Baerts (NGI0)'s avatar
      selftests: mptcp: join: mark 'fail' tests as flaky · 562f8862
      Matthieu Baerts (NGI0) authored
      [ Upstream commit 38af56e6 ]
      
      These tests are rarely unstable. It depends on the CI running the tests,
      especially if it is also busy doing other tasks in parallel, and if a
      debug kernel config is being used.
      
      It looks like this issue is sometimes present with the NetDev CI. While
      this is being investigated, the tests are marked as flaky not to create
      noises on such CIs.
      
      Fixes: b6e074e1
      
       ("selftests: mptcp: add infinite map testcase")
      Link: https://github.com/multipath-tcp/mptcp_net-next/issues/491
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://lore.kernel.org/r/20240524-upstream-net-20240524-selftests-mptcp-flaky-v1-4-a352362f3f8e@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      562f8862
    • Geliang Tang's avatar
      selftests: mptcp: add ms units for tc-netem delay · 99ac814e
      Geliang Tang authored
      [ Upstream commit 9109853a
      
       ]
      
      'delay 1' in tc-netem is confusing, not sure if it's a delay of 1 second or
      1 millisecond. This patch explicitly adds millisecond units to make these
      commands clearer.
      
      Signed-off-by: default avatarGeliang Tang <tanggeliang@kylinos.cn>
      Reviewed-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: 38af56e6
      
       ("selftests: mptcp: join: mark 'fail' tests as flaky")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      99ac814e
    • Matthieu Baerts (NGI0)'s avatar
      selftests: mptcp: simult flows: mark 'unbalanced' tests as flaky · 052c9f0c
      Matthieu Baerts (NGI0) authored
      [ Upstream commit cc73a657 ]
      
      These tests are flaky since their introduction. This might be less or
      not visible depending on the CI running the tests, especially if it is
      also busy doing other tasks in parallel.
      
      A first analysis shown that the transfer can be slowed down when there
      are some re-injections at the MPTCP level. Such re-injections can of
      course happen, and disturb the transfer, but it looks strange to have
      them in this lab. That could be caused by the kernel having access to
      less CPU cycles -- e.g. when other activities are executed in parallel
      -- or by a misinterpretation on the MPTCP packet scheduler side.
      
      While this is being investigated, the tests are marked as flaky not to
      create noises in other CIs.
      
      Fixes: 219d0499
      
       ("mptcp: push pending frames when subflow has free space")
      Link: https://github.com/multipath-tcp/mptcp_net-next/issues/475
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://lore.kernel.org/r/20240524-upstream-net-20240524-selftests-mptcp-flaky-v1-2-a352362f3f8e@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      052c9f0c
    • Jacob Keller's avatar
      ice: fix accounting if a VLAN already exists · 71e61511
      Jacob Keller authored
      [ Upstream commit 82617b9a ]
      
      The ice_vsi_add_vlan() function is used to add a VLAN filter for the target
      VSI. This function prepares a filter in the switch table for the given VSI.
      If it succeeds, the vsi->num_vlan counter is incremented.
      
      It is not considered an error to add a VLAN which already exists in the
      switch table, so the function explicitly checks and ignores -EEXIST. The
      vsi->num_vlan counter is still incremented.
      
      This seems incorrect, as it means we can double-count in the case where the
      same VLAN is added twice by the caller. The actual table will have one less
      filter than the count.
      
      The ice_vsi_del_vlan() function similarly checks and handles the -ENOENT
      condition for when deleting a filter that doesn't exist. This flow only
      decrements the vsi->num_vlan if it actually deleted a filter.
      
      The vsi->num_vlan counter is used only in a few places, primarily related
      to tracking the number of non-zero VLANs. If the vsi->num_vlans gets out of
      sync, then ice_vsi_num_non_zero_vlans() will incorrectly report more VLANs
      than are present, and ice_vsi_has_non_zero_vlans() could return true
      potentially in cases where there are only VLAN 0 filters left.
      
      Fix this by only incrementing the vsi->num_vlan in the case where we
      actually added an entry, and not in the case where the entry already
      existed.
      
      Fixes: a1ffafb0
      
       ("ice: Support configuring the device to Double VLAN Mode")
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarPucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/20240523-net-2024-05-23-intel-net-fixes-v1-2-17a923e0bb5f@intel.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      71e61511
    • Horatiu Vultur's avatar
      net: micrel: Fix lan8841_config_intr after getting out of sleep mode · 98101ca2
      Horatiu Vultur authored
      [ Upstream commit 4fb67904 ]
      
      When the interrupt is enabled, the function lan8841_config_intr tries to
      clear any pending interrupts by reading the interrupt status, then
      checks the return value for errors and then continue to enable the
      interrupt. It has been seen that once the system gets out of sleep mode,
      the interrupt status has the value 0x400 meaning that the PHY detected
      that the link was in low power. That is correct value but the problem is
      that the check is wrong.  We try to check for errors but we return an
      error also in this case which is not an error. Therefore fix this by
      returning only when there is an error.
      
      Fixes: a8f1a19d
      
       ("net: micrel: Add support for lan8841 PHY")
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Reviewed-by: default avatarSuman Ghosh <sumang@marvell.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Link: https://lore.kernel.org/r/20240524085350.359812-1-horatiu.vultur@microchip.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      98101ca2
    • Xiaolei Wang's avatar
      net:fec: Add fec_enet_deinit() · f0c58df7
      Xiaolei Wang authored
      [ Upstream commit bf0497f5 ]
      
      When fec_probe() fails or fec_drv_remove() needs to release the
      fec queue and remove a NAPI context, therefore add a function
      corresponding to fec_enet_init() and call fec_enet_deinit() which
      does the opposite to release memory and remove a NAPI context.
      
      Fixes: 59d0f746
      
       ("net: fec: init multi queue date structure")
      Signed-off-by: default avatarXiaolei Wang <xiaolei.wang@windriver.com>
      Reviewed-by: default avatarWei Fang <wei.fang@nxp.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20240524050528.4115581-1-xiaolei.wang@windriver.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f0c58df7
    • Jakub Sitnicki's avatar
      bpf: Allow delete from sockmap/sockhash only if update is allowed · 000a65bf
      Jakub Sitnicki authored
      [ Upstream commit 98e948fb ]
      
      We have seen an influx of syzkaller reports where a BPF program attached to
      a tracepoint triggers a locking rule violation by performing a map_delete
      on a sockmap/sockhash.
      
      We don't intend to support this artificial use scenario. Extend the
      existing verifier allowed-program-type check for updating sockmap/sockhash
      to also cover deleting from a map.
      
      From now on only BPF programs which were previously allowed to update
      sockmap/sockhash can delete from these map types.
      
      Fixes: ff910599
      
       ("bpf, sockmap: Prevent lock inversion deadlock in map delete elem")
      Reported-by: default avatarTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
      Reported-by: default avatar <syzbot+ec941d6e24f633a59172@syzkaller.appspotmail.com>
      Signed-off-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Tested-by: default avatar <syzbot+ec941d6e24f633a59172@syzkaller.appspotmail.com>
      Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=ec941d6e24f633a59172
      Link: https://lore.kernel.org/bpf/20240527-sockmap-verify-deletes-v1-1-944b372f2101@cloudflare.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      000a65bf
    • Charles Keepax's avatar
      ASoC: cs42l43: Only restrict 44.1kHz for the ASP · 5da6d51d
      Charles Keepax authored
      [ Upstream commit 797c525e ]
      
      The SoundWire interface can always support 44.1kHz using flow controlled
      mode, and whether the ASP is in master mode should obviously only affect
      the ASP. Update cs42l43_startup() to only restrict the rates for the ASP
      DAI.
      
      Fixes: fc918cbe
      
       ("ASoC: cs42l43: Add support for the cs42l43")
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Link: https://msgid.link/r/20240527100840.439832-1-ckeepax@opensource.cirrus.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5da6d51d
    • Parthiban Veerasooran's avatar
      net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM · ec361a0f
      Parthiban Veerasooran authored
      [ Upstream commit 52a2f060 ]
      
      LED Select (LED_SEL) bit in the LED General Purpose IO Configuration
      register is used to determine the functionality of external LED pins
      (Speed Indicator, Link and Activity Indicator, Full Duplex Link
      Indicator). The default value for this bit is 0 when no EEPROM is
      present. If a EEPROM is present, the default value is the value of the
      LED Select bit in the Configuration Flags of the EEPROM. A USB Reset or
      Lite Reset (LRST) will cause this bit to be restored to the image value
      last loaded from EEPROM, or to be set to 0 if no EEPROM is present.
      
      While configuring the dual purpose GPIO/LED pins to LED outputs in the
      LED General Purpose IO Configuration register, the LED_SEL bit is changed
      as 0 and resulting the configured value from the EEPROM is cleared. The
      issue is fixed by using read-modify-write approach.
      
      Fixes: f293501c
      
       ("smsc95xx: configure LED outputs")
      Signed-off-by: default avatarParthiban Veerasooran <Parthiban.Veerasooran@microchip.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Reviewed-by: default avatarWoojung Huh <woojung.huh@microchip.com>
      Link: https://lore.kernel.org/r/20240523085314.167650-1-Parthiban.Veerasooran@microchip.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ec361a0f
    • Hariprasad Kelam's avatar
      Octeontx2-pf: Free send queue buffers incase of leaf to inner · 208d0434
      Hariprasad Kelam authored
      [ Upstream commit 16848421 ]
      
      There are two type of classes. "Leaf classes" that are  the
      bottom of the class hierarchy. "Inner classes" that are neither
      the root class nor leaf classes. QoS rules can only specify leaf
      classes as targets for traffic.
      
      			 Root
      		        /  \
      		       /    \
                            1      2
                                   /\
                                  /  \
                                 4    5
                     classes 1,4 and 5 are leaf classes.
                     class 2 is a inner class.
      
      When a leaf class made as inner, or vice versa, resources associated
      with send queue (send queue buffers and transmit schedulers) are not
      getting freed.
      
      Fixes: 5e6808b4
      
       ("octeontx2-pf: Add support for HTB offload")
      Signed-off-by: default avatarHariprasad Kelam <hkelam@marvell.com>
      Link: https://lore.kernel.org/r/20240523073626.4114-1-hkelam@marvell.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      208d0434
    • Kuniyuki Iwashima's avatar
      af_unix: Read sk->sk_hash under bindlock during bind(). · ac325c7f
      Kuniyuki Iwashima authored
      [ Upstream commit 51d1b25a ]
      
      syzkaller reported data-race of sk->sk_hash in unix_autobind() [0],
      and the same ones exist in unix_bind_bsd() and unix_bind_abstract().
      
      The three bind() functions prefetch sk->sk_hash locklessly and
      use it later after validating that unix_sk(sk)->addr is NULL under
      unix_sk(sk)->bindlock.
      
      The prefetched sk->sk_hash is the hash value of unbound socket set
      in unix_create1() and does not change until bind() completes.
      
      There could be a chance that sk->sk_hash changes after the lockless
      read.  However, in such a case, non-NULL unix_sk(sk)->addr is visible
      under unix_sk(sk)->bindlock, and bind() returns -EINVAL without using
      the prefetched value.
      
      The KCSAN splat is false-positive, but let's silence it by reading
      sk->sk_hash under unix_sk(sk)->bindlock.
      
      [0]:
      BUG: KCSAN: data-race in unix_autobind / unix_autobind
      
      write to 0xffff888034a9fb88 of 4 bytes by task 4468 on cpu 0:
       __unix_set_addr_hash net/unix/af_unix.c:331 [inline]
       unix_autobind+0x47a/0x7d0 net/unix/af_unix.c:1185
       unix_dgram_connect+0x7e3/0x890 net/unix/af_unix.c:1373
       __sys_connect_file+0xd7/0xe0 net/socket.c:2048
       __sys_connect+0x114/0x140 net/socket.c:2065
       __do_sys_connect net/socket.c:2075 [inline]
       __se_sys_connect net/socket.c:2072 [inline]
       __x64_sys_connect+0x40/0x50 net/socket.c:2072
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x4f/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x46/0x4e
      
      read to 0xffff888034a9fb88 of 4 bytes by task 4465 on cpu 1:
       unix_autobind+0x28/0x7d0 net/unix/af_unix.c:1134
       unix_dgram_connect+0x7e3/0x890 net/unix/af_unix.c:1373
       __sys_connect_file+0xd7/0xe0 net/socket.c:2048
       __sys_connect+0x114/0x140 net/socket.c:2065
       __do_sys_connect net/socket.c:2075 [inline]
       __se_sys_connect net/socket.c:2072 [inline]
       __x64_sys_connect+0x40/0x50 net/socket.c:2072
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x4f/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x46/0x4e
      
      value changed: 0x000000e4 -> 0x000001e3
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 1 PID: 4465 Comm: syz-executor.0 Not tainted 6.8.0-12822-gcd51db110a7e #12
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
      
      Fixes: afd20b92
      
       ("af_unix: Replace the big lock with small locks.")
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Link: https://lore.kernel.org/r/20240522154218.78088-1-kuniyu@amazon.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ac325c7f
    • Kuniyuki Iwashima's avatar
      af_unix: Annotate data-race around unix_sk(sk)->addr. · 302fe8dd
      Kuniyuki Iwashima authored
      [ Upstream commit 97e1db06 ]
      
      Once unix_sk(sk)->addr is assigned under net->unx.table.locks and
      unix_sk(sk)->bindlock, *(unix_sk(sk)->addr) and unix_sk(sk)->path are
      fully set up, and unix_sk(sk)->addr is never changed.
      
      unix_getname() and unix_copy_addr() access the two fields locklessly,
      and commit ae3b5641 ("missing barriers in some of unix_sock ->addr
      and ->path accesses") added smp_store_release() and smp_load_acquire()
      pairs.
      
      In other functions, we still read unix_sk(sk)->addr locklessly to check
      if the socket is bound, and KCSAN complains about it.  [0]
      
      Given these functions have no dependency for *(unix_sk(sk)->addr) and
      unix_sk(sk)->path, READ_ONCE() is enough to annotate the data-race.
      
      Note that it is safe to access unix_sk(sk)->addr locklessly if the socket
      is found in the hash table.  For example, the lockless read of otheru->addr
      in unix_stream_connect() is safe.
      
      Note also that newu->addr there is of the child socket that is still not
      accessible from userspace, and smp_store_release() publishes the address
      in case the socket is accept()ed and unix_getname() / unix_copy_addr()
      is called.
      
      [0]:
      BUG: KCSAN: data-race in unix_bind / unix_listen
      
      write (marked) to 0xffff88805f8d1840 of 8 bytes by task 13723 on cpu 0:
       __unix_set_addr_hash net/unix/af_unix.c:329 [inline]
       unix_bind_bsd net/unix/af_unix.c:1241 [inline]
       unix_bind+0x881/0x1000 net/unix/af_unix.c:1319
       __sys_bind+0x194/0x1e0 net/socket.c:1847
       __do_sys_bind net/socket.c:1858 [inline]
       __se_sys_bind net/socket.c:1856 [inline]
       __x64_sys_bind+0x40/0x50 net/socket.c:1856
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x4f/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x46/0x4e
      
      read to 0xffff88805f8d1840 of 8 bytes by task 13724 on cpu 1:
       unix_listen+0x72/0x180 net/unix/af_unix.c:734
       __sys_listen+0xdc/0x160 net/socket.c:1881
       __do_sys_listen net/socket.c:1890 [inline]
       __se_sys_listen net/socket.c:1888 [inline]
       __x64_sys_listen+0x2e/0x40 net/socket.c:1888
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x4f/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x46/0x4e
      
      value changed: 0x0000000000000000 -> 0xffff88807b5b1b40
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 1 PID: 13724 Comm: syz-executor.4 Not tainted 6.8.0-12822-gcd51db110a7e #12
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Link: https://lore.kernel.org/r/20240522154002.77857-1-kuniyu@amazon.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      302fe8dd
    • Roded Zats's avatar
      enic: Validate length of nl attributes in enic_set_vf_port · f6638e95
      Roded Zats authored
      [ Upstream commit e8021b94 ]
      
      enic_set_vf_port assumes that the nl attribute IFLA_PORT_PROFILE
      is of length PORT_PROFILE_MAX and that the nl attributes
      IFLA_PORT_INSTANCE_UUID, IFLA_PORT_HOST_UUID are of length PORT_UUID_MAX.
      These attributes are validated (in the function do_setlink in rtnetlink.c)
      using the nla_policy ifla_port_policy. The policy defines IFLA_PORT_PROFILE
      as NLA_STRING, IFLA_PORT_INSTANCE_UUID as NLA_BINARY and
      IFLA_PORT_HOST_UUID as NLA_STRING. That means that the length validation
      using the policy is for the max size of the attributes and not on exact
      size so the length of these attributes might be less than the sizes that
      enic_set_vf_port expects. This might cause an out of bands
      read access in the memcpys of the data of these
      attributes in enic_set_vf_port.
      
      Fixes: f8bd9091
      
       ("net: Add ndo_{set|get}_vf_port support for enic dynamic vnics")
      Signed-off-by: default avatarRoded Zats <rzats@paloaltonetworks.com>
      Link: https://lore.kernel.org/r/20240522073044.33519-1-rzats@paloaltonetworks.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f6638e95
    • Luke D. Jones's avatar
      ALSA: hda/realtek: Adjust G814JZR to use SPI init for amp · 07bbe666
      Luke D. Jones authored
      [ Upstream commit 2be46155 ]
      
      The 2024 ASUS ROG G814J model is much the same as the 2023 model
      and the 2023 16" version. We can use the same Cirrus Amp quirk.
      
      Fixes: 811dd426
      
       ("ALSA: hda/realtek: Add quirks for Asus ROG 2024 laptops using CS35L41")
      Signed-off-by: default avatarLuke D. Jones <luke@ljones.dev>
      Link: https://lore.kernel.org/r/20240526091032.114545-1-luke@ljones.dev
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      07bbe666
    • Takashi Iwai's avatar
      ALSA: core: Remove debugfs at disconnection · cb9c2bd4
      Takashi Iwai authored
      [ Upstream commit 495000a3 ]
      
      The card-specific debugfs entries are removed at the last stage of
      card free phase, and it's performed after synchronization of the
      closes of all opened fds.  This works fine for most cases, but it can
      be potentially problematic for a hotplug device like USB-audio.  Due
      to the nature of snd_card_free_when_closed(), the card free isn't
      called immediately after the driver removal for a hotplug device, but
      it's left until the last fd is closed.  It implies that the card
      debugfs entries also remain.  Meanwhile, when a new device is inserted
      before the last close and the very same card slot is assigned, the
      driver tries to create the card debugfs root again on the very same
      path.  This conflicts with the remaining entry, and results in the
      kernel warning such as:
        debugfs: Directory 'card0' with parent 'sound' already present!
      with the missing debugfs entry afterwards.
      
      For avoiding such conflicts, remove debugfs entries at the device
      disconnection phase instead.  The jack kctl debugfs entries get
      removed in snd_jack_dev_disconnect() instead of each kctl
      private_free.
      
      Fixes: 2d670ea2
      
       ("ALSA: jack: implement software jack injection via debugfs")
      Link: https://lore.kernel.org/r/20240524151256.32521-1-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cb9c2bd4
    • Takashi Iwai's avatar
      ALSA: jack: Use guard() for locking · b26e0fa2
      Takashi Iwai authored
      [ Upstream commit 7234795b
      
       ]
      
      We can simplify the code gracefully with new guard() macro and co for
      automatic cleanup of locks.
      
      Only the code refactoring, and no functional changes.
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Link: https://lore.kernel.org/r/20240227085306.9764-11-tiwai@suse.de
      Stable-dep-of: 495000a3
      
       ("ALSA: core: Remove debugfs at disconnection")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b26e0fa2
    • Friedrich Vock's avatar
      bpf: Fix potential integer overflow in resolve_btfids · f58eec14
      Friedrich Vock authored
      [ Upstream commit 44382b3e ]
      
      err is a 32-bit integer, but elf_update returns an off_t, which is 64-bit
      at least on 64-bit platforms. If symbols_patch is called on a binary between
      2-4GB in size, the result will be negative when cast to a 32-bit integer,
      which the code assumes means an error occurred. This can wrongly trigger
      build failures when building very large kernel images.
      
      Fixes: fbbb68de
      
       ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
      Signed-off-by: default avatarFriedrich Vock <friedrich.vock@gmx.de>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20240514070931.199694-1-friedrich.vock@gmx.de
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f58eec14
    • Tetsuo Handa's avatar
      dma-buf/sw-sync: don't enable IRQ from sync_print_obj() · a4ee7824
      Tetsuo Handa authored
      [ Upstream commit b7949189 ]
      
      Since commit a6aa8fca
      
       ("dma-buf/sw-sync: Reduce irqsave/irqrestore from
      known context") by error replaced spin_unlock_irqrestore() with
      spin_unlock_irq() for both sync_debugfs_show() and sync_print_obj() despite
      sync_print_obj() is called from sync_debugfs_show(), lockdep complains
      inconsistent lock state warning.
      
      Use plain spin_{lock,unlock}() for sync_print_obj(), for
      sync_debugfs_show() is already using spin_{lock,unlock}_irq().
      
      Reported-by: default avatarsyzbot <syzbot+a225ee3df7e7f9372dbe@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=a225ee3df7e7f9372dbe
      Fixes: a6aa8fca
      
       ("dma-buf/sw-sync: Reduce irqsave/irqrestore from known context")
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/c2e46020-aaa6-4e06-bf73-f05823f913f0@I-love.SAKURA.ne.jp
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a4ee7824
    • Gal Pressman's avatar
      net/mlx5e: Fix UDP GSO for encapsulated packets · de1a0a2d
      Gal Pressman authored
      [ Upstream commit 83fea49f ]
      
      When the skb is encapsulated, adjust the inner UDP header instead of the
      outer one, and account for UDP header (instead of TCP) in the inline
      header size calculation.
      
      Fixes: 689adf0d
      
       ("net/mlx5e: Add UDP GSO support")
      Reported-by: default avatarJason Baron <jbaron@akamai.com>
      Closes: https://lore.kernel.org/netdev/c42961cb-50b9-4a9a-bd43-87fe48d88d29@akamai.com/
      Signed-off-by: default avatarGal Pressman <gal@nvidia.com>
      Reviewed-by: default avatarDragos Tatulea <dtatulea@nvidia.com>
      Reviewed-by: default avatarBoris Pismenny <borisp@nvidia.com>
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      de1a0a2d
    • Carolina Jubran's avatar
      net/mlx5e: Use rx_missed_errors instead of rx_dropped for reporting buffer exhaustion · 33933f00
      Carolina Jubran authored
      [ Upstream commit 5c74195d ]
      
      Previously, the driver incorrectly used rx_dropped to report device
      buffer exhaustion.
      
      According to the documentation, rx_dropped should not be used to count
      packets dropped due to buffer exhaustion, which is the purpose of
      rx_missed_errors.
      
      Use rx_missed_errors as intended for counting packets dropped due to
      buffer exhaustion.
      
      Fixes: 269e6b3a
      
       ("net/mlx5e: Report additional error statistics in get stats ndo")
      Signed-off-by: default avatarCarolina Jubran <cjubran@nvidia.com>
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      33933f00
    • Rahul Rameshbabu's avatar
      net/mlx5e: Fix IPsec tunnel mode offload feature check · aa60de63
      Rahul Rameshbabu authored
      [ Upstream commit 9a52f6d4 ]
      
      Remove faulty check disabling checksum offload and GSO for offload of
      simple IPsec tunnel L4 traffic. Comment previously describing the deleted
      code incorrectly claimed the check prevented double tunnel (or three layers
      of ip headers).
      
      Fixes: f1267798
      
       ("net/mlx5: Fix checksum issue of VXLAN and IPsec crypto offload")
      Signed-off-by: default avatarRahul Rameshbabu <rrameshbabu@nvidia.com>
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      aa60de63
    • Rahul Rameshbabu's avatar
      net/mlx5: Use mlx5_ipsec_rx_status_destroy to correctly delete status rules · b0a15cde
      Rahul Rameshbabu authored
      [ Upstream commit 16d66a4f ]
      
      rx_create no longer allocates a modify_hdr instance that needs to be
      cleaned up. The mlx5_modify_header_dealloc call will lead to a NULL pointer
      dereference. A leak in the rules also previously occurred since there are
      now two rules populated related to status.
      
        BUG: kernel NULL pointer dereference, address: 0000000000000000
        #PF: supervisor read access in kernel mode
        #PF: error_code(0x0000) - not-present page
        PGD 109907067 P4D 109907067 PUD 116890067 PMD 0
        Oops: 0000 [#1] SMP
        CPU: 1 PID: 484 Comm: ip Not tainted 6.9.0-rc2-rrameshbabu+ #254
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS Arch Linux 1.16.3-1-1 04/01/2014
        RIP: 0010:mlx5_modify_header_dealloc+0xd/0x70
        <snip>
        Call Trace:
         <TASK>
         ? show_regs+0x60/0x70
         ? __die+0x24/0x70
         ? page_fault_oops+0x15f/0x430
         ? free_to_partial_list.constprop.0+0x79/0x150
         ? do_user_addr_fault+0x2c9/0x5c0
         ? exc_page_fault+0x63/0x110
         ? asm_exc_page_fault+0x27/0x30
         ? mlx5_modify_header_dealloc+0xd/0x70
         rx_create+0x374/0x590
         rx_add_rule+0x3ad/0x500
         ? rx_add_rule+0x3ad/0x500
         ? mlx5_cmd_exec+0x2c/0x40
         ? mlx5_create_ipsec_obj+0xd6/0x200
         mlx5e_accel_ipsec_fs_add_rule+0x31/0xf0
         mlx5e_xfrm_add_state+0x426/0xc00
        <snip>
      
      Fixes: 94af50c0
      
       ("net/mlx5e: Unify esw and normal IPsec status table creation/destruction")
      Signed-off-by: default avatarRahul Rameshbabu <rrameshbabu@nvidia.com>
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b0a15cde
    • Gal Pressman's avatar
      net/mlx5: Fix MTMP register capability offset in MCAM register · fb035aa9
      Gal Pressman authored
      [ Upstream commit 1b9f86c6 ]
      
      The MTMP register (0x900a) capability offset is off-by-one, move it to
      the right place.
      
      Fixes: 1f507e80
      
       ("net/mlx5: Expose NIC temperature via hardware monitoring kernel API")
      Signed-off-by: default avatarGal Pressman <gal@nvidia.com>
      Reviewed-by: default avatarCosmin Ratiu <cratiu@nvidia.com>
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fb035aa9