Skip to content
  1. Oct 06, 2021
    • Oliver Neukum's avatar
      hso: fix bailout in error case of probe · ed26ab7a
      Oliver Neukum authored
      commit 5fcfb6d0
      
       upstream.
      
      The driver tries to reuse code for disconnect in case
      of a failed probe.
      If resources need to be freed after an error in probe, the
      netdev must not be freed because it has never been registered.
      Fix it by telling the helper which path we are in.
      
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarOvidiu Panait <ovidiu.panait@windriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed26ab7a
    • Suzuki K Poulose's avatar
      arm64: Extend workaround for erratum 1024718 to all versions of Cortex-A55 · c13d897b
      Suzuki K Poulose authored
      commit c0b15c25
      
       upstream.
      
      The erratum 1024718 affects Cortex-A55 r0p0 to r2p0. However
      we apply the work around for r0p0 - r1p0. Unfortunately this
      won't be fixed for the future revisions for the CPU. Thus
      extend the work around for all versions of A55, to cover
      for r2p0 and any future revisions.
      
      Cc: stable@vger.kernel.org
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: James Morse <james.morse@arm.com>
      Cc: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20210203230057.3961239-1-suzuki.poulose@arm.com
      [will: Update Kconfig help text]
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      [Nanyon: adjust for stable version below v4.16, which set TCR_HD earlier
      in assembly code]
      Signed-off-by: default avatarNanyong Sun <sunnanyong@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c13d897b
    • Alex Sverdlin's avatar
      ARM: 9098/1: ftrace: MODULE_PLT: Fix build problem without DYNAMIC_FTRACE · ed6c090b
      Alex Sverdlin authored
      commit 6fa630bf
      
       upstream
      
      FTRACE_ADDR is only defined when CONFIG_DYNAMIC_FTRACE is defined, the
      latter is even stronger requirement than CONFIG_FUNCTION_TRACER (which is
      enough for MCOUNT_ADDR).
      
      Link: https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/thread/ZUVCQBHDMFVR7CCB7JPESLJEWERZDJ3T/
      
      Fixes: 1f12fb25c5c5d22f ("ARM: 9079/1: ftrace: Add MODULE_PLTS support")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed6c090b
    • Alex Sverdlin's avatar
      ARM: 9079/1: ftrace: Add MODULE_PLTS support · d0db7cfb
      Alex Sverdlin authored
      commit 79f32b22
      
       upstream
      
      Teach ftrace_make_call() and ftrace_make_nop() about PLTs.
      Teach PLT code about FTRACE and all its callbacks.
      Otherwise the following might happen:
      
      ------------[ cut here ]------------
      WARNING: CPU: 14 PID: 2265 at .../arch/arm/kernel/insn.c:14 __arm_gen_branch+0x83/0x8c()
      ...
      Hardware name: LSI Axxia AXM55XX
      [<c0314a49>] (unwind_backtrace) from [<c03115e9>] (show_stack+0x11/0x14)
      [<c03115e9>] (show_stack) from [<c0519f51>] (dump_stack+0x81/0xa8)
      [<c0519f51>] (dump_stack) from [<c032185d>] (warn_slowpath_common+0x69/0x90)
      [<c032185d>] (warn_slowpath_common) from [<c03218f3>] (warn_slowpath_null+0x17/0x1c)
      [<c03218f3>] (warn_slowpath_null) from [<c03143cf>] (__arm_gen_branch+0x83/0x8c)
      [<c03143cf>] (__arm_gen_branch) from [<c0314337>] (ftrace_make_nop+0xf/0x24)
      [<c0314337>] (ftrace_make_nop) from [<c038ebcb>] (ftrace_process_locs+0x27b/0x3e8)
      [<c038ebcb>] (ftrace_process_locs) from [<c0378d79>] (load_module+0x11e9/0x1a44)
      [<c0378d79>] (load_module) from [<c037974d>] (SyS_finit_module+0x59/0x84)
      [<c037974d>] (SyS_finit_module) from [<c030e981>] (ret_fast_syscall+0x1/0x18)
      ---[ end trace e1b64ced7a89adcc ]---
      ------------[ cut here ]------------
      WARNING: CPU: 14 PID: 2265 at .../kernel/trace/ftrace.c:1979 ftrace_bug+0x1b1/0x234()
      ...
      Hardware name: LSI Axxia AXM55XX
      [<c0314a49>] (unwind_backtrace) from [<c03115e9>] (show_stack+0x11/0x14)
      [<c03115e9>] (show_stack) from [<c0519f51>] (dump_stack+0x81/0xa8)
      [<c0519f51>] (dump_stack) from [<c032185d>] (warn_slowpath_common+0x69/0x90)
      [<c032185d>] (warn_slowpath_common) from [<c03218f3>] (warn_slowpath_null+0x17/0x1c)
      [<c03218f3>] (warn_slowpath_null) from [<c038e87d>] (ftrace_bug+0x1b1/0x234)
      [<c038e87d>] (ftrace_bug) from [<c038ebd5>] (ftrace_process_locs+0x285/0x3e8)
      [<c038ebd5>] (ftrace_process_locs) from [<c0378d79>] (load_module+0x11e9/0x1a44)
      [<c0378d79>] (load_module) from [<c037974d>] (SyS_finit_module+0x59/0x84)
      [<c037974d>] (SyS_finit_module) from [<c030e981>] (ret_fast_syscall+0x1/0x18)
      ---[ end trace e1b64ced7a89adcd ]---
      ftrace failed to modify [<e9ef7006>] 0xe9ef7006
      actual: 02:f0:3b:fa
      ftrace record flags: 0
      (0) expected tramp: c0314265
      
      [florian: resolved merge conflict with struct
      dyn_arch_ftrace::old_mcount]
      
      Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0db7cfb
    • Alex Sverdlin's avatar
      ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link() · 29a8f3a3
      Alex Sverdlin authored
      commit 890cb057
      
       upstream
      
      Will be used in the following patch. No functional change.
      
      Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      29a8f3a3
    • Alex Sverdlin's avatar
      ARM: 9077/1: PLT: Move struct plt_entries definition to header · 49229b00
      Alex Sverdlin authored
      commit 4e271701
      
       upstream
      
      No functional change, later it will be re-used in several files.
      
      Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      49229b00
    • Sai Krishna Potthuri's avatar
      EDAC/synopsys: Fix wrong value type assignment for edac_mode · 27e30ed5
      Sai Krishna Potthuri authored
      commit 5297cfa6 upstream.
      
      dimm->edac_mode contains values of type enum edac_type - not the
      corresponding capability flags. Fix that.
      
      Issue caught by Coverity check "enumerated type mixed with another
      type."
      
       [ bp: Rewrite commit message, add tags. ]
      
      Fixes: ae9b56e3
      
       ("EDAC, synps: Add EDAC support for zynq ddr ecc controller")
      Signed-off-by: default avatarSai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
      Signed-off-by: default avatarShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: <stable@vger.kernel.org>
      Link: https://lkml.kernel.org/r/20210818072315.15149-1-shubhrajyoti.datta@xilinx.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27e30ed5
    • Eric Dumazet's avatar
      net: udp: annotate data race around udp_sk(sk)->corkflag · dfe1064a
      Eric Dumazet authored
      commit a9f59707 upstream.
      
      up->corkflag field can be read or written without any lock.
      Annotate accesses to avoid possible syzbot/KCSAN reports.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dfe1064a
    • yangerkun's avatar
      ext4: fix potential infinite loop in ext4_dx_readdir() · 7362dd8a
      yangerkun authored
      commit 42cb4474
      
       upstream.
      
      When ext4_htree_fill_tree() fails, ext4_dx_readdir() can run into an
      infinite loop since if info->last_pos != ctx->pos this will reset the
      directory scan and reread the failing entry.  For example:
      
      1. a dx_dir which has 3 block, block 0 as dx_root block, block 1/2 as
         leaf block which own the ext4_dir_entry_2
      2. block 1 read ok and call_filldir which will fill the dirent and update
         the ctx->pos
      3. block 2 read fail, but we has already fill some dirent, so we will
         return back to userspace will a positive return val(see ksys_getdents64)
      4. the second ext4_dx_readdir will reset the world since info->last_pos
         != ctx->pos, and will also init the curr_hash which pos to block 1
      5. So we will read block1 too, and once block2 still read fail, we can
         only fill one dirent because the hash of the entry in block1(besides
         the last one) won't greater than curr_hash
      6. this time, we forget update last_pos too since the read for block2
         will fail, and since we has got the one entry, ksys_getdents64 can
         return success
      7. Latter we will trapped in a loop with step 4~6
      
      Cc: stable@kernel.org
      Signed-off-by: default avataryangerkun <yangerkun@huawei.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Link: https://lore.kernel.org/r/20210914111415.3921954-1-yangerkun@huawei.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7362dd8a
    • Johan Hovold's avatar
      ipack: ipoctal: fix module reference leak · dde4c142
      Johan Hovold authored
      commit bb8a4fcb upstream.
      
      A reference to the carrier module was taken on every open but was only
      released once when the final reference to the tty struct was dropped.
      
      Fix this by taking the module reference and initialising the tty driver
      data when installing the tty.
      
      Fixes: 82a82340
      
       ("ipoctal: get carrier driver to avoid rmmod")
      Cc: stable@vger.kernel.org      # 3.18
      Cc: Federico Vaga <federico.vaga@cern.ch>
      Acked-by: default avatarSamuel Iglesias Gonsalvez <siglesias@igalia.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Link: https://lore.kernel.org/r/20210917114622.5412-6-johan@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dde4c142
    • Johan Hovold's avatar
      ipack: ipoctal: fix missing allocation-failure check · 58e818cd
      Johan Hovold authored
      commit 445c8132 upstream.
      
      Add the missing error handling when allocating the transmit buffer to
      avoid dereferencing a NULL pointer in write() should the allocation
      ever fail.
      
      Fixes: ba4dc61f
      
       ("Staging: ipack: add support for IP-OCTAL mezzanine board")
      Cc: stable@vger.kernel.org      # 3.5
      Acked-by: default avatarSamuel Iglesias Gonsalvez <siglesias@igalia.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Link: https://lore.kernel.org/r/20210917114622.5412-5-johan@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      58e818cd
    • Johan Hovold's avatar
      ipack: ipoctal: fix tty-registration error handling · 9314f882
      Johan Hovold authored
      commit cd20d592 upstream.
      
      Registration of the ipoctal tty devices is unlikely to fail, but if it
      ever does, make sure not to deregister a never registered tty device
      (and dereference a NULL pointer) when the driver is later unbound.
      
      Fixes: 2afb41d9
      
       ("Staging: ipack/devices/ipoctal: Check tty_register_device return value.")
      Cc: stable@vger.kernel.org      # 3.7
      Acked-by: default avatarSamuel Iglesias Gonsalvez <siglesias@igalia.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Link: https://lore.kernel.org/r/20210917114622.5412-4-johan@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9314f882
    • Johan Hovold's avatar
      ipack: ipoctal: fix tty registration race · 372f4cca
      Johan Hovold authored
      commit 65c001df upstream.
      
      Make sure to set the tty class-device driver data before registering the
      tty to avoid having a racing open() dereference a NULL pointer.
      
      Fixes: 9c1d784a
      
       ("Staging: ipack/devices/ipoctal: Get rid of ipoctal_list.")
      Cc: stable@vger.kernel.org      # 3.7
      Acked-by: default avatarSamuel Iglesias Gonsalvez <siglesias@igalia.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Link: https://lore.kernel.org/r/20210917114622.5412-3-johan@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      372f4cca
    • Johan Hovold's avatar
      ipack: ipoctal: fix stack information leak · 27259259
      Johan Hovold authored
      commit a89936cc upstream.
      
      The tty driver name is used also after registering the driver and must
      specifically not be allocated on the stack to avoid leaking information
      to user space (or triggering an oops).
      
      Drivers should not try to encode topology information in the tty device
      name but this one snuck in through staging without anyone noticing and
      another driver has since copied this malpractice.
      
      Fixing the ABI is a separate issue, but this at least plugs the security
      hole.
      
      Fixes: ba4dc61f
      
       ("Staging: ipack: add support for IP-OCTAL mezzanine board")
      Cc: stable@vger.kernel.org      # 3.5
      Acked-by: default avatarSamuel Iglesias Gonsalvez <siglesias@igalia.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Link: https://lore.kernel.org/r/20210917114622.5412-2-johan@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27259259
    • Eric Dumazet's avatar
      af_unix: fix races in sk_peer_pid and sk_peer_cred accesses · 9d76f723
      Eric Dumazet authored
      [ Upstream commit 35306eb2 ]
      
      Jann Horn reported that SO_PEERCRED and SO_PEERGROUPS implementations
      are racy, as af_unix can concurrently change sk_peer_pid and sk_peer_cred.
      
      In order to fix this issue, this patch adds a new spinlock that needs
      to be used whenever these fields are read or written.
      
      Jann also pointed out that l2cap_sock_get_peer_pid_cb() is currently
      reading sk->sk_peer_pid which makes no sense, as this field
      is only possibly set by AF_UNIX sockets.
      We will have to clean this in a separate patch.
      This could be done by reverting b48596d1 "Bluetooth: L2CAP: Add get_peer_pid callback"
      or implementing what was truly expected.
      
      Fixes: 109f6e39
      
       ("af_unix: Allow SO_PEERCRED to work across namespaces.")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarJann Horn <jannh@google.com>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Cc: Marcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9d76f723
    • Rahul Lakkireddy's avatar
      scsi: csiostor: Add module softdep on cxgb4 · a9664da5
      Rahul Lakkireddy authored
      [ Upstream commit 79a74822 ]
      
      Both cxgb4 and csiostor drivers run on their own independent Physical
      Function. But when cxgb4 and csiostor are both being loaded in parallel via
      modprobe, there is a race when firmware upgrade is attempted by both the
      drivers.
      
      When the cxgb4 driver initiates the firmware upgrade, it halts the firmware
      and the chip until upgrade is complete. When the csiostor driver is coming
      up in parallel, the firmware mailbox communication fails with timeouts and
      the csiostor driver probe fails.
      
      Add a module soft dependency on cxgb4 driver to ensure loading csiostor
      triggers cxgb4 to load first when available to avoid the firmware upgrade
      race.
      
      Link: https://lore.kernel.org/r/1632759248-15382-1-git-send-email-rahul.lakkireddy@chelsio.com
      Fixes: a3667aae
      
       ("[SCSI] csiostor: Chelsio FCoE offload driver")
      Signed-off-by: default avatarRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a9664da5
    • Jacob Keller's avatar
      e100: fix buffer overrun in e100_get_regs · 47aa8890
      Jacob Keller authored
      [ Upstream commit 51032e6f ]
      
      The e100_get_regs function is used to implement a simple register dump
      for the e100 device. The data is broken into a couple of MAC control
      registers, and then a series of PHY registers, followed by a memory dump
      buffer.
      
      The total length of the register dump is defined as (1 + E100_PHY_REGS)
      * sizeof(u32) + sizeof(nic->mem->dump_buf).
      
      The logic for filling in the PHY registers uses a convoluted inverted
      count for loop which counts from E100_PHY_REGS (0x1C) down to 0, and
      assigns the slots 1 + E100_PHY_REGS - i. The first loop iteration will
      fill in [1] and the final loop iteration will fill in [1 + 0x1C]. This
      is actually one more than the supposed number of PHY registers.
      
      The memory dump buffer is then filled into the space at
      [2 + E100_PHY_REGS] which will cause that memcpy to assign 4 bytes past
      the total size.
      
      The end result is that we overrun the total buffer size allocated by the
      kernel, which could lead to a panic or other issues due to memory
      corruption.
      
      It is difficult to determine the actual total number of registers
      here. The only 8255x datasheet I could find indicates there are 28 total
      MDI registers. However, we're reading 29 here, and reading them in
      reverse!
      
      In addition, the ethtool e100 register dump interface appears to read
      the first PHY register to determine if the device is in MDI or MDIx
      mode. This doesn't appear to be documented anywhere within the 8255x
      datasheet. I can only assume it must be in register 28 (the extra
      register we're reading here).
      
      Lets not change any of the intended meaning of what we copy here. Just
      extend the space by 4 bytes to account for the extra register and
      continue copying the data out in the same order.
      
      Change the E100_PHY_REGS value to be the correct total (29) so that the
      total register dump size is calculated properly. Fix the offset for
      where we copy the dump buffer so that it doesn't overrun the total size.
      
      Re-write the for loop to use counting up instead of the convoluted
      down-counting. Correct the mdio_read offset to use the 0-based register
      offsets, but maintain the bizarre reverse ordering so that we have the
      ABI expected by applications like ethtool. This requires and additional
      subtraction of 1. It seems a bit odd but it makes the flow of assignment
      into the register buffer easier to follow.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Reported-by: default avatarFelicitas Hetzelt <felicitashetzelt@gmail.com>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      47aa8890
    • Jacob Keller's avatar
      e100: fix length calculation in e100_get_regs_len · a8c99596
      Jacob Keller authored
      [ Upstream commit 4329c8dc ]
      
      commit abf9b902 ("e100: cleanup unneeded math") tried to simplify
      e100_get_regs_len and remove a double 'divide and then multiply'
      calculation that the e100_reg_regs_len function did.
      
      This change broke the size calculation entirely as it failed to account
      for the fact that the numbered registers are actually 4 bytes wide and
      not 1 byte. This resulted in a significant under allocation of the
      register buffer used by e100_get_regs.
      
      Fix this by properly multiplying the register count by u32 first before
      adding the size of the dump buffer.
      
      Fixes: abf9b902
      
       ("e100: cleanup unneeded math")
      Reported-by: default avatarFelicitas Hetzelt <felicitashetzelt@gmail.com>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a8c99596
    • Paul Fertser's avatar
      hwmon: (tmp421) fix rounding for negative values · 6378e8a5
      Paul Fertser authored
      [ Upstream commit 724e8af8 ]
      
      Old code produces -24999 for 0b1110011100000000 input in standard format due to
      always rounding up rather than "away from zero".
      
      Use the common macro for division, unify and simplify the conversion code along
      the way.
      
      Fixes: 9410700b
      
       ("hwmon: Add driver for Texas Instruments TMP421/422/423 sensor chips")
      Signed-off-by: default avatarPaul Fertser <fercerpav@gmail.com>
      Link: https://lore.kernel.org/r/20210924093011.26083-3-fercerpav@gmail.com
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6378e8a5
    • Xin Long's avatar
      sctp: break out if skb_header_pointer returns NULL in sctp_rcv_ootb · 77bc7dcf
      Xin Long authored
      [ Upstream commit f7e745f8 ]
      
      We should always check if skb_header_pointer's return is NULL before
      using it, otherwise it may cause null-ptr-deref, as syzbot reported:
      
        KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
        RIP: 0010:sctp_rcv_ootb net/sctp/input.c:705 [inline]
        RIP: 0010:sctp_rcv+0x1d84/0x3220 net/sctp/input.c:196
        Call Trace:
        <IRQ>
         sctp6_rcv+0x38/0x60 net/sctp/ipv6.c:1109
         ip6_protocol_deliver_rcu+0x2e9/0x1ca0 net/ipv6/ip6_input.c:422
         ip6_input_finish+0x62/0x170 net/ipv6/ip6_input.c:463
         NF_HOOK include/linux/netfilter.h:307 [inline]
         NF_HOOK include/linux/netfilter.h:301 [inline]
         ip6_input+0x9c/0xd0 net/ipv6/ip6_input.c:472
         dst_input include/net/dst.h:460 [inline]
         ip6_rcv_finish net/ipv6/ip6_input.c:76 [inline]
         NF_HOOK include/linux/netfilter.h:307 [inline]
         NF_HOOK include/linux/netfilter.h:301 [inline]
         ipv6_rcv+0x28c/0x3c0 net/ipv6/ip6_input.c:297
      
      Fixes: 3acb50c1
      
       ("sctp: delay as much as possible skb_linearize")
      Reported-by: default avatar <syzbot+581aff2ae6b860625116@syzkaller.appspotmail.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      77bc7dcf
    • Lorenzo Bianconi's avatar
      mac80211: limit injected vht mcs/nss in ieee80211_parse_tx_radiotap · ce5f372f
      Lorenzo Bianconi authored
      [ Upstream commit 13cb6d82
      
       ]
      
      Limit max values for vht mcs and nss in ieee80211_parse_tx_radiotap
      routine in order to fix the following warning reported by syzbot:
      
      WARNING: CPU: 0 PID: 10717 at include/net/mac80211.h:989 ieee80211_rate_set_vht include/net/mac80211.h:989 [inline]
      WARNING: CPU: 0 PID: 10717 at include/net/mac80211.h:989 ieee80211_parse_tx_radiotap+0x101e/0x12d0 net/mac80211/tx.c:2244
      Modules linked in:
      CPU: 0 PID: 10717 Comm: syz-executor.5 Not tainted 5.14.0-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:ieee80211_rate_set_vht include/net/mac80211.h:989 [inline]
      RIP: 0010:ieee80211_parse_tx_radiotap+0x101e/0x12d0 net/mac80211/tx.c:2244
      RSP: 0018:ffffc9000186f3e8 EFLAGS: 00010216
      RAX: 0000000000000618 RBX: ffff88804ef76500 RCX: ffffc900143a5000
      RDX: 0000000000040000 RSI: ffffffff888f478e RDI: 0000000000000003
      RBP: 00000000ffffffff R08: 0000000000000000 R09: 0000000000000100
      R10: ffffffff888f46f9 R11: 0000000000000000 R12: 00000000fffffff8
      R13: ffff88804ef7653c R14: 0000000000000001 R15: 0000000000000004
      FS:  00007fbf5718f700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000001b2de23000 CR3: 000000006a671000 CR4: 00000000001506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
      Call Trace:
       ieee80211_monitor_select_queue+0xa6/0x250 net/mac80211/iface.c:740
       netdev_core_pick_tx+0x169/0x2e0 net/core/dev.c:4089
       __dev_queue_xmit+0x6f9/0x3710 net/core/dev.c:4165
       __bpf_tx_skb net/core/filter.c:2114 [inline]
       __bpf_redirect_no_mac net/core/filter.c:2139 [inline]
       __bpf_redirect+0x5ba/0xd20 net/core/filter.c:2162
       ____bpf_clone_redirect net/core/filter.c:2429 [inline]
       bpf_clone_redirect+0x2ae/0x420 net/core/filter.c:2401
       bpf_prog_eeb6f53a69e5c6a2+0x59/0x234
       bpf_dispatcher_nop_func include/linux/bpf.h:717 [inline]
       __bpf_prog_run include/linux/filter.h:624 [inline]
       bpf_prog_run include/linux/filter.h:631 [inline]
       bpf_test_run+0x381/0xa30 net/bpf/test_run.c:119
       bpf_prog_test_run_skb+0xb84/0x1ee0 net/bpf/test_run.c:663
       bpf_prog_test_run kernel/bpf/syscall.c:3307 [inline]
       __sys_bpf+0x2137/0x5df0 kernel/bpf/syscall.c:4605
       __do_sys_bpf kernel/bpf/syscall.c:4691 [inline]
       __se_sys_bpf kernel/bpf/syscall.c:4689 [inline]
       __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4689
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x4665f9
      
      Reported-by: default avatar <syzbot+0196ac871673f0c20f68@syzkaller.appspotmail.com>
      Fixes: 646e76bb
      
       ("mac80211: parse VHT info in injected frames")
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Link: https://lore.kernel.org/r/c26c3f02dcb38ab63b2f2534cb463d95ee81bb13.1632141760.git.lorenzo@kernel.org
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ce5f372f
    • Chih-Kang Chang's avatar
      mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug · 8eb22641
      Chih-Kang Chang authored
      [ Upstream commit fe94bac6 ]
      
      In ieee80211_amsdu_aggregate() set a pointer frag_tail point to the
      end of skb_shinfo(head)->frag_list, and use it to bind other skb in
      the end of this function. But when execute ieee80211_amsdu_aggregate()
      ->ieee80211_amsdu_realloc_pad()->pskb_expand_head(), the address of
      skb_shinfo(head)->frag_list will be changed. However, the
      ieee80211_amsdu_aggregate() not update frag_tail after call
      pskb_expand_head(). That will cause the second skb can't bind to the
      head skb appropriately.So we update the address of frag_tail to fix it.
      
      Fixes: 6e0456b5
      
       ("mac80211: add A-MSDU tx support")
      Signed-off-by: default avatarChih-Kang Chang <gary.chang@realtek.com>
      Signed-off-by: default avatarZong-Zhe Yang <kevin_yang@realtek.com>
      Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
      Link: https://lore.kernel.org/r/20210830073240.12736-1-pkshih@realtek.com
      [reword comment]
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8eb22641
    • Andrea Claudi's avatar
      ipvs: check that ip_vs_conn_tab_bits is between 8 and 20 · fbaeca0e
      Andrea Claudi authored
      [ Upstream commit 69e73dbf ]
      
      ip_vs_conn_tab_bits may be provided by the user through the
      conn_tab_bits module parameter. If this value is greater than 31, or
      less than 0, the shift operator used to derive tab_size causes undefined
      behaviour.
      
      Fix this checking ip_vs_conn_tab_bits value to be in the range specified
      in ipvs Kconfig. If not, simply use default value.
      
      Fixes: 6f7edb48
      
       ("IPVS: Allow boot time change of hash size")
      Reported-by: default avatarYi Chen <yiche@redhat.com>
      Signed-off-by: default avatarAndrea Claudi <aclaudi@redhat.com>
      Acked-by: default avatarJulian Anastasov <ja@ssi.bg>
      Acked-by: default avatarSimon Horman <horms@verge.net.au>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fbaeca0e
    • Johannes Berg's avatar
      mac80211: fix use-after-free in CCMP/GCMP RX · f556e1d6
      Johannes Berg authored
      commit 94513069 upstream.
      
      When PN checking is done in mac80211, for fragmentation we need
      to copy the PN to the RX struct so we can later use it to do a
      comparison, since commit bf30ca92 ("mac80211: check defrag
      PN against current frame").
      
      Unfortunately, in that commit I used the 'hdr' variable without
      it being necessarily valid, so use-after-free could occur if it
      was necessary to reallocate (parts of) the frame.
      
      Fix this by reloading the variable after the code that results
      in the reallocations, if any.
      
      This fixes https://bugzilla.kernel.org/show_bug.cgi?id=214401.
      
      Cc: stable@vger.kernel.org
      Fixes: bf30ca92
      
       ("mac80211: check defrag PN against current frame")
      Link: https://lore.kernel.org/r/20210927115838.12b9ac6bb233.I1d066acd5408a662c3b6e828122cd314fcb28cdb@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f556e1d6
    • James Morse's avatar
      cpufreq: schedutil: Destroy mutex before kobject_put() frees the memory · 514643ea
      James Morse authored
      [ Upstream commit cdef1196 ]
      
      Since commit e5c6b312 ("cpufreq: schedutil: Use kobject release()
      method to free sugov_tunables") kobject_put() has kfree()d the
      attr_set before gov_attr_set_put() returns.
      
      kobject_put() isn't the last user of attr_set in gov_attr_set_put(),
      the subsequent mutex_destroy() triggers a use-after-free:
      | BUG: KASAN: use-after-free in mutex_is_locked+0x20/0x60
      | Read of size 8 at addr ffff000800ca4250 by task cpuhp/2/20
      |
      | CPU: 2 PID: 20 Comm: cpuhp/2 Not tainted 5.15.0-rc1 #12369
      | Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development
      | Platform, BIOS EDK II Jul 30 2018
      | Call trace:
      |  dump_backtrace+0x0/0x380
      |  show_stack+0x1c/0x30
      |  dump_stack_lvl+0x8c/0xb8
      |  print_address_description.constprop.0+0x74/0x2b8
      |  kasan_report+0x1f4/0x210
      |  kasan_check_range+0xfc/0x1a4
      |  __kasan_check_read+0x38/0x60
      |  mutex_is_locked+0x20/0x60
      |  mutex_destroy+0x80/0x100
      |  gov_attr_set_put+0xfc/0x150
      |  sugov_exit+0x78/0x190
      |  cpufreq_offline.isra.0+0x2c0/0x660
      |  cpuhp_cpufreq_offline+0x14/0x24
      |  cpuhp_invoke_callback+0x430/0x6d0
      |  cpuhp_thread_fun+0x1b0/0x624
      |  smpboot_thread_fn+0x5e0/0xa6c
      |  kthread+0x3a0/0x450
      |  ret_from_fork+0x10/0x20
      
      Swap the order of the calls.
      
      Fixes: e5c6b312
      
       ("cpufreq: schedutil: Use kobject release() method to free sugov_tunables")
      Cc: 4.7+ <stable@vger.kernel.org> # 4.7+
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      514643ea
    • Kevin Hao's avatar
      cpufreq: schedutil: Use kobject release() method to free sugov_tunables · 463c4670
      Kevin Hao authored
      [ Upstream commit e5c6b312 ]
      
      The struct sugov_tunables is protected by the kobject, so we can't free
      it directly. Otherwise we would get a call trace like this:
        ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x30
        WARNING: CPU: 3 PID: 720 at lib/debugobjects.c:505 debug_print_object+0xb8/0x100
        Modules linked in:
        CPU: 3 PID: 720 Comm: a.sh Tainted: G        W         5.14.0-rc1-next-20210715-yocto-standard+ #507
        Hardware name: Marvell OcteonTX CN96XX board (DT)
        pstate: 40400009 (nZcv daif +PAN -UAO -TCO BTYPE=--)
        pc : debug_print_object+0xb8/0x100
        lr : debug_print_object+0xb8/0x100
        sp : ffff80001ecaf910
        x29: ffff80001ecaf910 x28: ffff00011b10b8d0 x27: ffff800011043d80
        x26: ffff00011a8f0000 x25: ffff800013cb3ff0 x24: 0000000000000000
        x23: ffff80001142aa68 x22: ffff800011043d80 x21: ffff00010de46f20
        x20: ffff800013c0c520 x19: ffff800011d8f5b0 x18: 0000000000000010
        x17: 6e6968207473696c x16: 5f72656d6974203a x15: 6570797420746365
        x14: 6a626f2029302065 x13: 303378302f307830 x12: 2b6e665f72656d69
        x11: ffff8000124b1560 x10: ffff800012331520 x9 : ffff8000100ca6b0
        x8 : 000000000017ffe8 x7 : c0000000fffeffff x6 : 0000000000000001
        x5 : ffff800011d8c000 x4 : ffff800011d8c740 x3 : 0000000000000000
        x2 : ffff0001108301c0 x1 : ab3c90eedf9c0f00 x0 : 0000000000000000
        Call trace:
         debug_print_object+0xb8/0x100
         __debug_check_no_obj_freed+0x1c0/0x230
         debug_check_no_obj_freed+0x20/0x88
         slab_free_freelist_hook+0x154/0x1c8
         kfree+0x114/0x5d0
         sugov_exit+0xbc/0xc0
         cpufreq_exit_governor+0x44/0x90
         cpufreq_set_policy+0x268/0x4a8
         store_scaling_governor+0xe0/0x128
         store+0xc0/0xf0
         sysfs_kf_write+0x54/0x80
         kernfs_fop_write_iter+0x128/0x1c0
         new_sync_write+0xf0/0x190
         vfs_write+0x2d4/0x478
         ksys_write+0x74/0x100
         __arm64_sys_write+0x24/0x30
         invoke_syscall.constprop.0+0x54/0xe0
         do_el0_svc+0x64/0x158
         el0_svc+0x2c/0xb0
         el0t_64_sync_handler+0xb0/0xb8
         el0t_64_sync+0x198/0x19c
        irq event stamp: 5518
        hardirqs last  enabled at (5517): [<ffff8000100cbd7c>] console_unlock+0x554/0x6c8
        hardirqs last disabled at (5518): [<ffff800010fc0638>] el1_dbg+0x28/0xa0
        softirqs last  enabled at (5504): [<ffff8000100106e0>] __do_softirq+0x4d0/0x6c0
        softirqs last disabled at (5483): [<ffff800010049548>] irq_exit+0x1b0/0x1b8
      
      So split the original sugov_tunables_free() into two functions,
      sugov_clear_global_tunables() is just used to clear the global_tunables
      and the new sugov_tunables_free() is used as kobj_type::release to
      release the sugov_tunables safely.
      
      Fixes: 9bdcb44e
      
       ("cpufreq: schedutil: New governor based on scheduler utilization data")
      Cc: 4.7+ <stable@vger.kernel.org> # 4.7+
      Signed-off-by: default avatarKevin Hao <haokexin@gmail.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      463c4670
    • Igor Matheus Andrade Torrente's avatar
      tty: Fix out-of-bound vmalloc access in imageblit · 067c694d
      Igor Matheus Andrade Torrente authored
      [ Upstream commit 3b0c4061
      
       ]
      
      This issue happens when a userspace program does an ioctl
      FBIOPUT_VSCREENINFO passing the fb_var_screeninfo struct
      containing only the fields xres, yres, and bits_per_pixel
      with values.
      
      If this struct is the same as the previous ioctl, the
      vc_resize() detects it and doesn't call the resize_screen(),
      leaving the fb_var_screeninfo incomplete. And this leads to
      the updatescrollmode() calculates a wrong value to
      fbcon_display->vrows, which makes the real_y() return a
      wrong value of y, and that value, eventually, causes
      the imageblit to access an out-of-bound address value.
      
      To solve this issue I made the resize_screen() be called
      even if the screen does not need any resizing, so it will
      "fix and fill" the fb_var_screeninfo independently.
      
      Cc: stable <stable@vger.kernel.org> # after 5.15-rc2 is out, give it time to bake
      Reported-and-tested-by: default avatar <syzbot+858dc7a2f7ef07c2c219@syzkaller.appspotmail.com>
      Signed-off-by: default avatarIgor Matheus Andrade Torrente <igormtorrente@gmail.com>
      Link: https://lore.kernel.org/r/20210628134509.15895-1-igormtorrente@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      067c694d
    • Linus Torvalds's avatar
      qnx4: work around gcc false positive warning bug · 40faa4d1
      Linus Torvalds authored
      commit d5f65459 upstream.
      
      In commit b7213ffa
      
       ("qnx4: avoid stringop-overread errors") I tried
      to teach gcc about how the directory entry structure can be two
      different things depending on a status flag.  It made the code clearer,
      and it seemed to make gcc happy.
      
      However, Arnd points to a gcc bug, where despite using two different
      members of a union, gcc then gets confused, and uses the size of one of
      the members to decide if a string overrun happens.  And not necessarily
      the rigth one.
      
      End result: with some configurations, gcc-11 will still complain about
      the source buffer size being overread:
      
        fs/qnx4/dir.c: In function 'qnx4_readdir':
        fs/qnx4/dir.c:76:32: error: 'strnlen' specified bound [16, 48] exceeds source size 1 [-Werror=stringop-overread]
           76 |                         size = strnlen(name, size);
              |                                ^~~~~~~~~~~~~~~~~~~
        fs/qnx4/dir.c:26:22: note: source object declared here
           26 |                 char de_name;
              |                      ^~~~~~~
      
      because gcc will get confused about which union member entry is actually
      getting accessed, even when the source code is very clear about it.  Gcc
      internally will have combined two "redundant" pointers (pointing to
      different union elements that are at the same offset), and takes the
      size checking from one or the other - not necessarily the right one.
      
      This is clearly a gcc bug, but we can work around it fairly easily.  The
      biggest thing here is the big honking comment about why we do what we
      do.
      
      Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c6
      Reported-and-tested-by: default avatarArnd Bergmann <arnd@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      40faa4d1
    • Juergen Gross's avatar
      xen/balloon: fix balloon kthread freezing · ab9755f7
      Juergen Gross authored
      commit 96f5bd03 upstream.
      
      Commit 8480ed9c ("xen/balloon: use a kernel thread instead a
      workqueue") switched the Xen balloon driver to use a kernel thread.
      Unfortunately the patch omitted to call try_to_freeze() or to use
      wait_event_freezable_timeout(), causing a system suspend to fail.
      
      Fixes: 8480ed9c
      
       ("xen/balloon: use a kernel thread instead a workqueue")
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Link: https://lore.kernel.org/r/20210920100345.21939-1-jgross@suse.com
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ab9755f7
    • Evan Wang's avatar
      PCI: aardvark: Fix checking for PIO status · e21c6587
      Evan Wang authored
      commit fcb461e2
      
       upstream.
      
      There is an issue that when PCIe switch is connected to an Armada 3700
      board, there will be lots of warnings about PIO errors when reading the
      config space. According to Aardvark PIO read and write sequence in HW
      specification, the current way to check PIO status has the following
      issues:
      
      1) For PIO read operation, it reports the error message, which should be
         avoided according to HW specification.
      
      2) For PIO read and write operations, it only checks PIO operation complete
         status, which is not enough, and error status should also be checked.
      
      This patch aligns the code with Aardvark PIO read and write sequence in HW
      specification on PIO status check and fix the warnings when reading config
      space.
      
      [pali: Fix CRS handling when CRSSVE is not enabled]
      
      Link: https://lore.kernel.org/r/20210722144041.12661-2-pali@kernel.org
      Tested-by: default avatarVictor Gu <xigu@marvell.com>
      Signed-off-by: default avatarEvan Wang <xswang@marvell.com>
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: default avatarVictor Gu <xigu@marvell.com>
      Reviewed-by: default avatarMarek Behún <kabel@kernel.org>
      Cc: stable@vger.kernel.org # b1bd5714
      
       ("PCI: aardvark: Indicate error in 'val' when config read fails")
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e21c6587
    • Pali Rohár's avatar
      PCI: aardvark: Fix checking for PIO Non-posted Request · 538d73db
      Pali Rohár authored
      commit 8ceeac30
      
       upstream.
      
      PIO_NON_POSTED_REQ for PIO_STAT register is incorrectly defined. Bit 10 in
      register PIO_STAT indicates the response is to a non-posted request.
      
      Link: https://lore.kernel.org/r/20210624213345.3617-2-pali@kernel.org
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: default avatarMarek Behún <kabel@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      538d73db
    • Pali Rohár's avatar
      arm64: dts: marvell: armada-37xx: Extend PCIe MEM space · 59a446e2
      Pali Rohár authored
      commit 514ef1e6
      
       upstream.
      
      Current PCIe MEM space of size 16 MB is not enough for some combination
      of PCIe cards (e.g. NVMe disk together with ath11k wifi card). ARM Trusted
      Firmware for Armada 3700 platform already assigns 128 MB for PCIe window,
      so extend PCIe MEM space to the end of 128 MB PCIe window which allows to
      allocate more PCIe BARs for more PCIe cards.
      
      Without this change some combination of PCIe cards cannot be used and
      kernel show error messages in dmesg during initialization:
      
          pci 0000:00:00.0: BAR 8: no space for [mem size 0x01800000]
          pci 0000:00:00.0: BAR 8: failed to assign [mem size 0x01800000]
          pci 0000:00:00.0: BAR 6: assigned [mem 0xe8000000-0xe80007ff pref]
          pci 0000:01:00.0: BAR 8: no space for [mem size 0x01800000]
          pci 0000:01:00.0: BAR 8: failed to assign [mem size 0x01800000]
          pci 0000:02:03.0: BAR 8: no space for [mem size 0x01000000]
          pci 0000:02:03.0: BAR 8: failed to assign [mem size 0x01000000]
          pci 0000:02:07.0: BAR 8: no space for [mem size 0x00100000]
          pci 0000:02:07.0: BAR 8: failed to assign [mem size 0x00100000]
          pci 0000:03:00.0: BAR 0: no space for [mem size 0x01000000 64bit]
          pci 0000:03:00.0: BAR 0: failed to assign [mem size 0x01000000 64bit]
      
      Due to bugs in U-Boot port for Turris Mox, the second range in Turris Mox
      kernel DTS file for PCIe must start at 16 MB offset. Otherwise U-Boot
      crashes during loading of kernel DTB file. This bug is present only in
      U-Boot code for Turris Mox and therefore other Armada 3700 devices are not
      affected by this bug. Bug is fixed in U-Boot version 2021.07.
      
      To not break booting new kernels on existing versions of U-Boot on Turris
      Mox, use first 16 MB range for IO and second range with rest of PCIe window
      for MEM.
      
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Fixes: 76f6386b
      
       ("arm64: dts: marvell: Add Aardvark PCIe support for Armada 3700")
      Signed-off-by: default avatarGregory CLEMENT <gregory.clement@bootlin.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      59a446e2
    • Linus Torvalds's avatar
      spi: Fix tegra20 build with CONFIG_PM=n · 89d9390e
      Linus Torvalds authored
      [ Upstream commit efafec27
      
       ]
      
      Without CONFIG_PM enabled, the SET_RUNTIME_PM_OPS() macro ends up being
      empty, and the only use of tegra_slink_runtime_{resume,suspend} goes
      away, resulting in
      
        drivers/spi/spi-tegra20-slink.c:1200:12: error: ‘tegra_slink_runtime_resume’ defined but not used [-Werror=unused-function]
         1200 | static int tegra_slink_runtime_resume(struct device *dev)
              |            ^~~~~~~~~~~~~~~~~~~~~~~~~~
        drivers/spi/spi-tegra20-slink.c:1188:12: error: ‘tegra_slink_runtime_suspend’ defined but not used [-Werror=unused-function]
         1188 | static int tegra_slink_runtime_suspend(struct device *dev)
              |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      mark the functions __maybe_unused to make the build happy.
      
      This hits the alpha allmodconfig build (and others).
      
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      89d9390e
    • Guenter Roeck's avatar
      net: 6pack: Fix tx timeout and slot time · f98836a0
      Guenter Roeck authored
      [ Upstream commit 3c0d2a46
      
       ]
      
      tx timeout and slot time are currently specified in units of HZ.  On
      Alpha, HZ is defined as 1024.  When building alpha:allmodconfig, this
      results in the following error message.
      
        drivers/net/hamradio/6pack.c: In function 'sixpack_open':
        drivers/net/hamradio/6pack.c:71:41: error:
        	unsigned conversion from 'int' to 'unsigned char'
        	changes value from '256' to '0'
      
      In the 6PACK protocol, tx timeout is specified in units of 10 ms and
      transmitted over the wire:
      
          https://www.linux-ax25.org/wiki/6PACK
      
      Defining a value dependent on HZ doesn't really make sense, and
      presumably comes from the (very historical) situation where HZ was
      originally 100.
      
      Note that the SIXP_SLOTTIME use explicitly is about 10ms granularity:
      
              mod_timer(&sp->tx_t, jiffies + ((when + 1) * HZ) / 100);
      
      and the SIXP_TXDELAY walue is sent as a byte over the wire.
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f98836a0
    • Guenter Roeck's avatar
      alpha: Declare virt_to_phys and virt_to_bus parameter as pointer to volatile · 2de807c0
      Guenter Roeck authored
      [ Upstream commit 35a3f4ef
      
       ]
      
      Some drivers pass a pointer to volatile data to virt_to_bus() and
      virt_to_phys(), and that works fine.  One exception is alpha.  This
      results in a number of compile errors such as
      
        drivers/net/wan/lmc/lmc_main.c: In function 'lmc_softreset':
        drivers/net/wan/lmc/lmc_main.c:1782:50: error:
      	passing argument 1 of 'virt_to_bus' discards 'volatile'
      	qualifier from pointer target type
      
        drivers/atm/ambassador.c: In function 'do_loader_command':
        drivers/atm/ambassador.c:1747:58: error:
      	passing argument 1 of 'virt_to_bus' discards 'volatile'
      	qualifier from pointer target type
      
      Declare the parameter of virt_to_phys and virt_to_bus as pointer to
      volatile to fix the problem.
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2de807c0
    • Dan Li's avatar
      arm64: Mark __stack_chk_guard as __ro_after_init · 0a52ba73
      Dan Li authored
      [ Upstream commit 9fcb2e93
      
       ]
      
      __stack_chk_guard is setup once while init stage and never changed
      after that.
      
      Although the modification of this variable at runtime will usually
      cause the kernel to crash (so does the attacker), it should be marked
      as __ro_after_init, and it should not affect performance if it is
      placed in the ro_after_init section.
      
      Signed-off-by: default avatarDan Li <ashimida@linux.alibaba.com>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Link: https://lore.kernel.org/r/1631612642-102881-1-git-send-email-ashimida@linux.alibaba.com
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0a52ba73
    • Helge Deller's avatar
      parisc: Use absolute_pointer() to define PAGE0 · 7596c2bd
      Helge Deller authored
      [ Upstream commit 90cc7bed
      
       ]
      
      Use absolute_pointer() wrapper for PAGE0 to avoid this compiler warning:
      
        arch/parisc/kernel/setup.c: In function 'start_parisc':
        error: '__builtin_memcmp_eq' specified bound 8 exceeds source size 0
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Co-Developed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7596c2bd
    • Linus Torvalds's avatar
      qnx4: avoid stringop-overread errors · 0abc7244
      Linus Torvalds authored
      [ Upstream commit b7213ffa
      
       ]
      
      The qnx4 directory entries are 64-byte blocks that have different
      contents depending on the a status byte that is in the last byte of the
      block.
      
      In particular, a directory entry can be either a "link info" entry with
      a 48-byte name and pointers to the real inode information, or an "inode
      entry" with a smaller 16-byte name and the full inode information.
      
      But the code was written to always just treat the directory name as if
      it was part of that "inode entry", and just extend the name to the
      longer case if the status byte said it was a link entry.
      
      That work just fine and gives the right results, but now that gcc is
      tracking data structure accesses much more, the code can trigger a
      compiler error about using up to 48 bytes (the long name) in a structure
      that only has that shorter name in it:
      
         fs/qnx4/dir.c: In function ‘qnx4_readdir’:
         fs/qnx4/dir.c:51:32: error: ‘strnlen’ specified bound 48 exceeds source size 16 [-Werror=stringop-overread]
            51 |                         size = strnlen(de->di_fname, size);
               |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         In file included from fs/qnx4/qnx4.h:3,
                          from fs/qnx4/dir.c:16:
         include/uapi/linux/qnx4_fs.h:45:25: note: source object declared here
            45 |         char            di_fname[QNX4_SHORT_NAME_MAX];
               |                         ^~~~~~~~
      
      which is because the source code doesn't really make this whole "one of
      two different types" explicit.
      
      Fix this by introducing a very explicit union of the two types, and
      basically explaining to the compiler what is really going on.
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0abc7244
    • Linus Torvalds's avatar
      sparc: avoid stringop-overread errors · 57c6e551
      Linus Torvalds authored
      [ Upstream commit fc7c028d
      
       ]
      
      The sparc mdesc code does pointer games with 'struct mdesc_hdr', but
      didn't describe to the compiler how that header is then followed by the
      data that the header describes.
      
      As a result, gcc is now unhappy since it does stricter pointer range
      tracking, and doesn't understand about how these things work.  This
      results in various errors like:
      
          arch/sparc/kernel/mdesc.c: In function ‘mdesc_node_by_name’:
          arch/sparc/kernel/mdesc.c:647:22: error: ‘strcmp’ reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
            647 |                 if (!strcmp(names + ep[ret].name_offset, name))
                |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      which are easily avoided by just describing 'struct mdesc_hdr' better,
      and making the node_block() helper function look into that unsized
      data[] that follows the header.
      
      This makes the sparc64 build happy again at least for my cross-compiler
      version (gcc version 11.2.1).
      
      Link: https://lore.kernel.org/lkml/CAHk-=wi4NW3NC0xWykkw=6LnjQD6D_rtRtxY9g8gQAJXtQMi8A@mail.gmail.com/
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      57c6e551
    • Guenter Roeck's avatar
      net: i825xx: Use absolute_pointer for memcpy from fixed memory location · d67202e1
      Guenter Roeck authored
      [ Upstream commit dff2d131
      
       ]
      
      gcc 11.x reports the following compiler warning/error.
      
        drivers/net/ethernet/i825xx/82596.c: In function 'i82596_probe':
        arch/m68k/include/asm/string.h:72:25: error:
      	'__builtin_memcpy' reading 6 bytes from a region of size 0 [-Werror=stringop-overread]
      
      Use absolute_pointer() to work around the problem.
      
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Reviewed-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d67202e1