Skip to content
  1. Sep 05, 2022
    • Kuniyuki Iwashima's avatar
      net: Fix a data-race around sysctl_tstamp_allow_data. · 64fca220
      Kuniyuki Iwashima authored
      [ Upstream commit d2154b0a ]
      
      While reading sysctl_tstamp_allow_data, it can be changed
      concurrently.  Thus, we need to add READ_ONCE() to its reader.
      
      Fixes: b245be1f
      
       ("net-timestamp: no-payload only sysctl")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      64fca220
    • Kuniyuki Iwashima's avatar
      ratelimit: Fix data-races in ___ratelimit(). · 509c21ea
      Kuniyuki Iwashima authored
      [ Upstream commit 6bae8ceb ]
      
      While reading rs->interval and rs->burst, they can be changed
      concurrently via sysctl (e.g. net_ratelimit_state).  Thus, we
      need to add READ_ONCE() to their readers.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      509c21ea
    • Pablo Neira Ayuso's avatar
      netfilter: nft_payload: report ERANGE for too long offset and length · 3cfdaa30
      Pablo Neira Ayuso authored
      [ Upstream commit 94254f99 ]
      
      Instead of offset and length are truncation to u8, report ERANGE.
      
      Fixes: 96518518
      
       ("netfilter: add nftables")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3cfdaa30
    • Jonathan Toppins's avatar
      bonding: 802.3ad: fix no transmission of LACPDUs · 4eec561a
      Jonathan Toppins authored
      [ Upstream commit d745b506 ]
      
      This is caused by the global variable ad_ticks_per_sec being zero as
      demonstrated by the reproducer script discussed below. This causes
      all timer values in __ad_timer_to_ticks to be zero, resulting
      in the periodic timer to never fire.
      
      To reproduce:
      Run the script in
      `tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh` which
      puts bonding into a state where it never transmits LACPDUs.
      
      line 44: ip link add fbond type bond mode 4 miimon 200 \
                  xmit_hash_policy 1 ad_actor_sys_prio 65535 lacp_rate fast
      setting bond param: ad_actor_sys_prio
      given:
          params.ad_actor_system = 0
      call stack:
          bond_option_ad_actor_sys_prio()
          -> bond_3ad_update_ad_actor_settings()
             -> set ad.system.sys_priority = bond->params.ad_actor_sys_prio
             -> ad.system.sys_mac_addr = bond->dev->dev_addr; because
                  params.ad_actor_system == 0
      results:
           ad.system.sys_mac_addr = bond->dev->dev_addr
      
      line 48: ip link set fbond address 52:54:00:3B:7C:A6
      setting bond MAC addr
      call stack:
          bond->dev->dev_addr = new_mac
      
      line 52: ip link set fbond type bond ad_actor_sys_prio 65535
      setting bond param: ad_actor_sys_prio
      given:
          params.ad_actor_system = 0
      call stack:
          bond_option_ad_actor_sys_prio()
          -> bond_3ad_update_ad_actor_settings()
             -> set ad.system.sys_priority = bond->params.ad_actor_sys_prio
             -> ad.system.sys_mac_addr = bond->dev->dev_addr; because
                  params.ad_actor_system == 0
      results:
           ad.system.sys_mac_addr = bond->dev->dev_addr
      
      line 60: ip link set veth1-bond down master fbond
      given:
          params.ad_actor_system = 0
          params.mode = BOND_MODE_8023AD
          ad.system.sys_mac_addr == bond->dev->dev_addr
      call stack:
          bond_enslave
          -> bond_3ad_initialize(); because first slave
             -> if ad.system.sys_mac_addr != bond->dev->dev_addr
                return
      results:
           Nothing is run in bond_3ad_initialize() because dev_addr equals
           sys_mac_addr leaving the global ad_ticks_per_sec zero as it is
           never initialized anywhere else.
      
      The if check around the contents of bond_3ad_initialize() is no longer
      needed due to commit 5ee14e6d ("bonding: 3ad: apply ad_actor settings
      changes immediately") which sets ad.system.sys_mac_addr if any one of
      the bonding parameters whos set function calls
      bond_3ad_update_ad_actor_settings(). This is because if
      ad.system.sys_mac_addr is zero it will be set to the current bond mac
      address, this causes the if check to never be true.
      
      Fixes: 5ee14e6d
      
       ("bonding: 3ad: apply ad_actor settings changes immediately")
      Signed-off-by: default avatarJonathan Toppins <jtoppins@redhat.com>
      Acked-by: default avatarJay Vosburgh <jay.vosburgh@canonical.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4eec561a
    • Bernard Pidoux's avatar
      rose: check NULL rose_loopback_neigh->loopback · 76885373
      Bernard Pidoux authored
      [ Upstream commit 3c53cd65 ]
      
      Commit 3b3fd068 added NULL check for
      `rose_loopback_neigh->dev` in rose_loopback_timer() but omitted to
      check rose_loopback_neigh->loopback.
      
      It thus prevents *all* rose connect.
      
      The reason is that a special rose_neigh loopback has a NULL device.
      
      /proc/net/rose_neigh illustrates it via rose_neigh_show() function :
      [...]
      seq_printf(seq, "%05d %-9s %-4s   %3d %3d  %3s     %3s %3lu %3lu",
      	   rose_neigh->number,
      	   (rose_neigh->loopback) ? "RSLOOP-0" : ax2asc(buf, &rose_neigh->callsign),
      	   rose_neigh->dev ? rose_neigh->dev->name : "???",
      	   rose_neigh->count,
      
      /proc/net/rose_neigh displays special rose_loopback_neigh->loopback as
      callsign RSLOOP-0:
      
      addr  callsign  dev  count use mode restart  t0  tf digipeaters
      00001 RSLOOP-0  ???      1   2  DCE     yes   0   0
      
      By checking rose_loopback_neigh->loopback, rose_rx_call_request() is called
      even in case rose_loopback_neigh->dev is NULL. This repairs rose connections.
      
      Verification with rose client application FPAC:
      
      FPAC-Node v 4.1.3 (built Aug  5 2022) for LINUX (help = h)
      F6BVP-4 (Commands = ?) : u
      Users - AX.25 Level 2 sessions :
      Port   Callsign     Callsign  AX.25 state  ROSE state  NetRom status
      axudp  F6BVP-5   -> F6BVP-9   Connected    Connected   ---------
      
      Fixes: 3b3fd068
      
       ("rose: Fix Null pointer dereference in rose_send_frame()")
      Signed-off-by: default avatarBernard Pidoux <f6bvp@free.fr>
      Suggested-by: default avatarFrancois Romieu <romieu@fr.zoreil.com>
      Cc: Thomas DL9SAU Osterried <thomas@osterried.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      76885373
    • Herbert Xu's avatar
      af_key: Do not call xfrm_probe_algs in parallel · e580d320
      Herbert Xu authored
      [ Upstream commit ba953a9d
      
       ]
      
      When namespace support was added to xfrm/afkey, it caused the
      previously single-threaded call to xfrm_probe_algs to become
      multi-threaded.  This is buggy and needs to be fixed with a mutex.
      
      Reported-by: default avatarAbhishek Shah <abhishek.shah@columbia.edu>
      Fixes: 283bc9f3
      
       ("xfrm: Namespacify xfrm state/policy locks")
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e580d320
    • Xin Xiong's avatar
      xfrm: fix refcount leak in __xfrm_policy_check() · 18e6b6e2
      Xin Xiong authored
      [ Upstream commit 9c9cb23e ]
      
      The issue happens on an error path in __xfrm_policy_check(). When the
      fetching process of the object `pols[1]` fails, the function simply
      returns 0, forgetting to decrement the reference count of `pols[0]`,
      which is incremented earlier by either xfrm_sk_policy_lookup() or
      xfrm_policy_lookup(). This may result in memory leaks.
      
      Fix it by decreasing the reference count of `pols[0]` in that path.
      
      Fixes: 134b0fc5
      
       ("IPsec: propagate security module errors up from flow_cache_lookup")
      Signed-off-by: default avatarXin Xiong <xiongx18@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      18e6b6e2
    • Helge Deller's avatar
      parisc: Fix exception handler for fldw and fstw instructions · 555666fd
      Helge Deller authored
      commit 7ae1f550
      
       upstream.
      
      The exception handler is broken for unaligned memory acceses with fldw
      and fstw instructions, because it trashes or uses randomly some other
      floating point register than the one specified in the instruction word
      on loads and stores.
      
      The instruction "fldw 0(addr),%fr22L" (and the other fldw/fstw
      instructions) encode the target register (%fr22) in the rightmost 5 bits
      of the instruction word. The 7th rightmost bit of the instruction word
      defines if the left or right half of %fr22 should be used.
      
      While processing unaligned address accesses, the FR3() define is used to
      extract the offset into the local floating-point register set.  But the
      calculation in FR3() was buggy, so that for example instead of %fr22,
      register %fr12 [((22 * 2) & 0x1f) = 12] was used.
      
      This bug has been since forever in the parisc kernel and I wonder why it
      wasn't detected earlier. Interestingly I noticed this bug just because
      the libime debian package failed to build on *native* hardware, while it
      successfully built in qemu.
      
      This patch corrects the bitshift and masking calculation in FR3().
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      555666fd
  2. Aug 25, 2022