Skip to content
  1. Sep 22, 2021
    • Adrian Bunk's avatar
      bnx2x: Fix enabling network interfaces without VFs · 0cca97c7
      Adrian Bunk authored
      commit 52ce14c1 upstream.
      
      This function is called to enable SR-IOV when available,
      not enabling interfaces without VFs was a regression.
      
      Fixes: 65161c35
      
       ("bnx2x: Fix missing error code in bnx2x_iov_init_one()")
      Signed-off-by: default avatarAdrian Bunk <bunk@kernel.org>
      Reported-by: default avatarYunQiang Su <wzssyqa@gmail.com>
      Tested-by: default avatarYunQiang Su <wzssyqa@gmail.com>
      Cc: stable@vger.kernel.org
      Acked-by: default avatarShai Malin <smalin@marvell.com>
      Link: https://lore.kernel.org/r/20210912190523.27991-1-bunk@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0cca97c7
    • Patryk Duda's avatar
      platform/chrome: cros_ec_proto: Send command again when timeout occurs · 7d949dc3
      Patryk Duda authored
      commit 3abc16af
      
       upstream.
      
      Sometimes kernel is trying to probe Fingerprint MCU (FPMCU) when it
      hasn't initialized SPI yet. This can happen because FPMCU is restarted
      during system boot and kernel can send message in short window
      eg. between sysjump to RW and SPI initialization.
      
      Cc: <stable@vger.kernel.org> # 4.4+
      Signed-off-by: default avatarPatryk Duda <pdk@semihalf.com>
      Link: https://lore.kernel.org/r/20210518140758.29318-1-pdk@semihalf.com
      Signed-off-by: default avatarBenson Leung <bleung@chromium.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7d949dc3
    • Mikulas Patocka's avatar
      parisc: fix crash with signals and alloca · cd6ede69
      Mikulas Patocka authored
      commit 030f6530
      
       upstream.
      
      I was debugging some crashes on parisc and I found out that there is a
      crash possibility if a function using alloca is interrupted by a signal.
      The reason for the crash is that the gcc alloca implementation leaves
      garbage in the upper 32 bits of the sp register. This normally doesn't
      matter (the upper bits are ignored because the PSW W-bit is clear),
      however the signal delivery routine in the kernel uses full 64 bits of sp
      and it fails with -EFAULT if the upper 32 bits are not zero.
      
      I created this program that demonstrates the problem:
      
      #include <stdlib.h>
      #include <unistd.h>
      #include <signal.h>
      #include <alloca.h>
      
      static __attribute__((noinline,noclone)) void aa(int *size)
      {
      	void * volatile p = alloca(-*size);
      	while (1) ;
      }
      
      static void handler(int sig)
      {
      	write(1, "signal delivered\n", 17);
      	_exit(0);
      }
      
      int main(void)
      {
      	int size = -0x100;
      	signal(SIGALRM, handler);
      	alarm(1);
      	aa(&size);
      }
      
      If you compile it with optimizations, it will crash.
      The "aa" function has this disassembly:
      
      000106a0 <aa>:
         106a0:       08 03 02 41     copy r3,r1
         106a4:       08 1e 02 43     copy sp,r3
         106a8:       6f c1 00 80     stw,ma r1,40(sp)
         106ac:       37 dc 3f c1     ldo -20(sp),ret0
         106b0:       0c 7c 12 90     stw ret0,8(r3)
         106b4:       0f 40 10 9c     ldw 0(r26),ret0		; ret0 = 0x00000000FFFFFF00
         106b8:       97 9c 00 7e     subi 3f,ret0,ret0	; ret0 = 0xFFFFFFFF0000013F
         106bc:       d7 80 1c 1a     depwi 0,31,6,ret0	; ret0 = 0xFFFFFFFF00000100
         106c0:       0b 9e 0a 1e     add,l sp,ret0,sp	;   sp = 0xFFFFFFFFxxxxxxxx
         106c4:       e8 1f 1f f7     b,l,n 106c4 <aa+0x24>,r0
      
      This patch fixes the bug by truncating the "usp" variable to 32 bits.
      
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cd6ede69
    • 王贇's avatar
      net: fix NULL pointer reference in cipso_v4_doi_free · 0587d1e6
      王贇 authored
      [ Upstream commit 733c99ee
      
       ]
      
      In netlbl_cipsov4_add_std() when 'doi_def->map.std' alloc
      failed, we sometime observe panic:
      
        BUG: kernel NULL pointer dereference, address:
        ...
        RIP: 0010:cipso_v4_doi_free+0x3a/0x80
        ...
        Call Trace:
         netlbl_cipsov4_add_std+0xf4/0x8c0
         netlbl_cipsov4_add+0x13f/0x1b0
         genl_family_rcv_msg_doit.isra.15+0x132/0x170
         genl_rcv_msg+0x125/0x240
      
      This is because in cipso_v4_doi_free() there is no check
      on 'doi_def->map.std' when 'doi_def->type' equal 1, which
      is possibe, since netlbl_cipsov4_add_std() haven't initialize
      it before alloc 'doi_def->map.std'.
      
      This patch just add the check to prevent panic happen for similar
      cases.
      
      Reported-by: default avatarAbaci <abaci@linux.alibaba.com>
      Signed-off-by: default avatarMichael Wang <yun.wang@linux.alibaba.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0587d1e6
    • Zekun Shen's avatar
      ath9k: fix OOB read ar9300_eeprom_restore_internal · f41f0add
      Zekun Shen authored
      [ Upstream commit 23151b9a
      
       ]
      
      Bad header can have large length field which can cause OOB.
      cptr is the last bytes for read, and the eeprom is parsed
      from high to low address. The OOB, triggered by the condition
      length > cptr could cause memory error with a read on
      negative index.
      
      There are some sanity check around length, but it is not
      compared with cptr (the remaining bytes). Here, the
      corrupted/bad EEPROM can cause panic.
      
      I was able to reproduce the crash, but I cannot find the
      log and the reproducer now. After I applied the patch, the
      bug is no longer reproducible.
      
      Signed-off-by: default avatarZekun Shen <bruceshenzk@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/YM3xKsQJ0Hw2hjrc@Zekuns-MBP-16.fios-router.home
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f41f0add
    • Colin Ian King's avatar
      parport: remove non-zero check on count · c39992bb
      Colin Ian King authored
      [ Upstream commit 0be883a0
      
       ]
      
      The check for count appears to be incorrect since a non-zero count
      check occurs a couple of statements earlier. Currently the check is
      always false and the dev->port->irq != PARPORT_IRQ_NONE part of the
      check is never tested and the if statement is dead-code. Fix this
      by removing the check on count.
      
      Note that this code is pre-git history, so I can't find a sha for
      it.
      
      Acked-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Addresses-Coverity: ("Logically dead code")
      Link: https://lore.kernel.org/r/20210730100710.27405-1-colin.king@canonical.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c39992bb
    • Mathias Nyman's avatar
      Revert "USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set" · b8381d36
      Mathias Nyman authored
      [ Upstream commit 2847c46c ]
      
      This reverts commit 5d5323a6
      
      .
      
      That commit effectively disabled Intel host initiated U1/U2 lpm for devices
      with periodic endpoints.
      
      Before that commit we disabled host initiated U1/U2 lpm if the exit latency
      was larger than any periodic endpoint service interval, this is according
      to xhci spec xhci 1.1 specification section 4.23.5.2
      
      After that commit we incorrectly checked that service interval was smaller
      than U1/U2 inactivity timeout. This is not relevant, and can't happen for
      Intel hosts as previously set U1/U2 timeout = 105% * service interval.
      
      Patch claimed it solved cases where devices can't be enumerated because of
      bandwidth issues. This might be true but it's a side effect of accidentally
      turning off lpm.
      
      exit latency calculations have been revised since then
      
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20210820123503.2605901-5-mathias.nyman@linux.intel.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b8381d36
    • Ding Hui's avatar
      cifs: fix wrong release in sess_alloc_buffer() failed path · d4a127e2
      Ding Hui authored
      [ Upstream commit d72c7419
      
       ]
      
      smb_buf is allocated by small_smb_init_no_tc(), and buf type is
      CIFS_SMALL_BUFFER, so we should use cifs_small_buf_release() to
      release it in failed path.
      
      Signed-off-by: default avatarDing Hui <dinghui@sangfor.com.cn>
      Reviewed-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d4a127e2
    • Thomas Hebb's avatar
      mmc: rtsx_pci: Fix long reads when clock is prescaled · a6da39dc
      Thomas Hebb authored
      [ Upstream commit 3ac5e452
      
       ]
      
      For unexplained reasons, the prescaler register for this device needs to
      be cleared (set to 1) while performing a data read or else the command
      will hang. This does not appear to affect the real clock rate sent out
      on the bus, so I assume it's purely to work around a hardware bug.
      
      During normal operation, the prescaler is already set to 1, so nothing
      needs to be done. However, in "initial mode" (which is used for sub-MHz
      clock speeds, like the core sets while enumerating cards), it's set to
      128 and so we need to reset it during data reads. We currently fail to
      do this for long reads.
      
      This has no functional affect on the driver's operation currently
      written, as the MMC core always sets a clock above 1MHz before
      attempting any long reads. However, the core could conceivably set any
      clock speed at any time and the driver should still work, so I think
      this fix is worthwhile.
      
      I personally encountered this issue while performing data recovery on an
      external chip. My connections had poor signal integrity, so I modified
      the core code to reduce the clock speed. Without this change, I saw the
      card enumerate but was unable to actually read any data.
      
      Writes don't seem to work in the situation described above even with
      this change (and even if the workaround is extended to encompass data
      write commands). I was not able to find a way to get them working.
      
      Signed-off-by: default avatarThomas Hebb <tommyhebb@gmail.com>
      Link: https://lore.kernel.org/r/2fef280d8409ab0100c26c6ac7050227defd098d.1627818365.git.tommyhebb@gmail.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a6da39dc
    • Bob Peterson's avatar
      gfs2: Don't call dlm after protocol is unmounted · 6aa628c4
      Bob Peterson authored
      [ Upstream commit d1340f80
      
       ]
      
      In the gfs2 withdraw sequence, the dlm protocol is unmounted with a call
      to lm_unmount. After a withdraw, users are allowed to unmount the
      withdrawn file system. But at that point we may still have glocks left
      over that we need to free via unmount's call to gfs2_gl_hash_clear.
      These glocks may have never been completed because of whatever problem
      caused the withdraw (IO errors or whatever).
      
      Before this patch, function gdlm_put_lock would still try to call into
      dlm to unlock these leftover glocks, which resulted in dlm returning
      -EINVAL because the lock space was abandoned. These glocks were never
      freed because there was no mechanism after that to free them.
      
      This patch adds a check to gdlm_put_lock to see if the locking protocol
      was inactive (DFL_UNMOUNT flag) and if so, free the glock and not
      make the invalid call into dlm.
      
      I could have combined this "if" with the one that follows, related to
      leftover glock LVBs, but I felt the code was more readable with its own
      if clause.
      
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6aa628c4
    • J. Bruce Fields's avatar
      rpc: fix gss_svc_init cleanup on failure · d9dc7a12
      J. Bruce Fields authored
      [ Upstream commit 5a475344
      
       ]
      
      The failure case here should be rare, but it's obviously wrong.
      
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d9dc7a12
    • Andreas Obergschwandtner's avatar
      ARM: tegra: tamonten: Fix UART pad setting · 6418b4be
      Andreas Obergschwandtner authored
      [ Upstream commit 2270ad2f
      
       ]
      
      This patch fixes the tristate and pullup configuration for UART 1 to 3
      on the Tamonten SOM.
      
      Signed-off-by: default avatarAndreas Obergschwandtner <andreas.obergschwandtner@gmail.com>
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6418b4be
    • Tuo Li's avatar
      gpu: drm: amd: amdgpu: amdgpu_i2c: fix possible uninitialized-variable access... · 7ea5848b
      Tuo Li authored
      gpu: drm: amd: amdgpu: amdgpu_i2c: fix possible uninitialized-variable access in amdgpu_i2c_router_select_ddc_port()
      
      [ Upstream commit a211260c
      
       ]
      
      The variable val is declared without initialization, and its address is
      passed to amdgpu_i2c_get_byte(). In this function, the value of val is
      accessed in:
        DRM_DEBUG("i2c 0x%02x 0x%02x read failed\n",
             addr, *val);
      
      Also, when amdgpu_i2c_get_byte() returns, val may remain uninitialized,
      but it is accessed in:
        val &= ~amdgpu_connector->router.ddc_mux_control_pin;
      
      To fix this possible uninitialized-variable access, initialize val to 0 in
      amdgpu_i2c_router_select_ddc_port().
      
      Reported-by: default avatarTOTE Robot <oslab@tsinghua.edu.cn>
      Signed-off-by: default avatarTuo Li <islituo@gmail.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7ea5848b
    • Desmond Cheong Zhi Xi's avatar
      Bluetooth: skip invalid hci_sync_conn_complete_evt · 470f7a68
      Desmond Cheong Zhi Xi authored
      [ Upstream commit 92fe24a7
      
       ]
      
      Syzbot reported a corrupted list in kobject_add_internal [1]. This
      happens when multiple HCI_EV_SYNC_CONN_COMPLETE event packets with
      status 0 are sent for the same HCI connection. This causes us to
      register the device more than once which corrupts the kset list.
      
      As this is forbidden behavior, we add a check for whether we're
      trying to process the same HCI_EV_SYNC_CONN_COMPLETE event multiple
      times for one connection. If that's the case, the event is invalid, so
      we report an error that the device is misbehaving, and ignore the
      packet.
      
      Link: https://syzkaller.appspot.com/bug?extid=66264bf2fd0476be7e6c [1]
      Reported-by: default avatar <syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com>
      Tested-by: default avatar <syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com>
      Signed-off-by: default avatarDesmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      470f7a68
    • Greg Kroah-Hartman's avatar
      serial: 8250_pci: make setup_port() parameters explicitly unsigned · 614bf36b
      Greg Kroah-Hartman authored
      [ Upstream commit 3a96e97a
      
       ]
      
      The bar and offset parameters to setup_port() are used in pointer math,
      and while it would be very difficult to get them to wrap as a negative
      number, just be "safe" and make them unsigned so that static checkers do
      not trip over them unintentionally.
      
      Cc: Jiri Slaby <jirislaby@kernel.org>
      Reported-by: default avatarJordy Zomer <jordy@pwning.systems>
      Link: https://lore.kernel.org/r/20210726130717.2052096-1-gregkh@linuxfoundation.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      614bf36b
    • Jiri Slaby's avatar
      hvsi: don't panic on tty_register_driver failure · 04eb6efb
      Jiri Slaby authored
      [ Upstream commit 7ccbdcc4
      
       ]
      
      The alloc_tty_driver failure is handled gracefully in hvsi_init. But
      tty_register_driver is not. panic is called if that one fails.
      
      So handle the failure of tty_register_driver gracefully too. This will
      keep at least the console functional as it was enabled earlier by
      console_initcall in hvsi_console_init. Instead of shooting down the
      whole system.
      
      This means, we disable interrupts and restore hvsi_wait back to
      poll_for_state().
      
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Link: https://lore.kernel.org/r/20210723074317.32690-3-jslaby@suse.cz
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      04eb6efb
    • Jiri Slaby's avatar
      xtensa: ISS: don't panic in rs_init · 3b294010
      Jiri Slaby authored
      [ Upstream commit 23411c72
      
       ]
      
      While alloc_tty_driver failure in rs_init would mean we have much bigger
      problem, there is no reason to panic when tty_register_driver fails
      there. It can fail for various reasons.
      
      So handle the failure gracefully. Actually handle them both while at it.
      This will make at least the console functional as it was enabled earlier
      by console_initcall in iss_console_init. Instead of shooting down the
      whole system.
      
      We move tty_port_init() after alloc_tty_driver(), so that we don't need
      to destroy the port in case the latter function fails.
      
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: linux-xtensa@linux-xtensa.org
      Acked-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Link: https://lore.kernel.org/r/20210723074317.32690-2-jslaby@suse.cz
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3b294010
    • Maciej W. Rozycki's avatar
      serial: 8250: Define RX trigger levels for OxSemi 950 devices · c42ffe93
      Maciej W. Rozycki authored
      [ Upstream commit d7aff291
      
       ]
      
      Oxford Semiconductor 950 serial port devices have a 128-byte FIFO and in
      the enhanced (650) mode, which we select in `autoconfig_has_efr' with
      the ECB bit set in the EFR register, they support the receive interrupt
      trigger level selectable with FCR bits 7:6 from the set of 16, 32, 112,
      120.  This applies to the original OX16C950 discrete UART[1] as well as
      950 cores embedded into more complex devices.
      
      For these devices we set the default to 112, which sets an excessively
      high level of 112 or 7/8 of the FIFO capacity, unlike with other port
      types where we choose at most 1/2 of their respective FIFO capacities.
      Additionally we don't make the trigger level configurable.  Consequently
      frequent input overruns happen with high bit rates where hardware flow
      control cannot be used (e.g. terminal applications) even with otherwise
      highly-performant systems.
      
      Lower the default receive interrupt trigger level to 32 then, and make
      it configurable.  Document the trigger levels along with other port
      types, including the set of 16, 32, 64, 112 for the transmit interrupt
      as well[2].
      
      References:
      
      [1] "OX16C950 rev B High Performance UART with 128 byte FIFOs", Oxford
          Semiconductor, Inc., DS-0031, Sep 05, Table 10: "Receiver Trigger
          Levels", p. 22
      
      [2] same, Table 9: "Transmit Interrupt Trigger Levels", p. 22
      
      Signed-off-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
      Link: https://lore.kernel.org/r/alpine.DEB.2.21.2106260608480.37803@angie.orcam.me.uk
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c42ffe93
    • Heiko Carstens's avatar
      s390/jump_label: print real address in a case of a jump label bug · d966bcab
      Heiko Carstens authored
      [ Upstream commit 5492886c
      
       ]
      
      In case of a jump label print the real address of the piece of code
      where a mismatch was detected. This is right before the system panics,
      so there is nothing revealed.
      
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d966bcab
    • Gustavo A. R. Silva's avatar
      ipv4: ip_output.c: Fix out-of-bounds warning in ip_copy_addrs() · 87b569d1
      Gustavo A. R. Silva authored
      [ Upstream commit 6321c7ac
      
       ]
      
      Fix the following out-of-bounds warning:
      
          In function 'ip_copy_addrs',
              inlined from '__ip_queue_xmit' at net/ipv4/ip_output.c:517:2:
      net/ipv4/ip_output.c:449:2: warning: 'memcpy' offset [40, 43] from the object at 'fl' is out of the bounds of referenced subobject 'saddr' with type 'unsigned int' at offset 36 [-Warray-bounds]
            449 |  memcpy(&iph->saddr, &fl4->saddr,
                |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            450 |         sizeof(fl4->saddr) + sizeof(fl4->daddr));
                |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      The problem is that the original code is trying to copy data into a
      couple of struct members adjacent to each other in a single call to
      memcpy(). This causes a legitimate compiler warning because memcpy()
      overruns the length of &iph->saddr and &fl4->saddr. As these are just
      a couple of struct members, fix this by using direct assignments,
      instead of memcpy().
      
      This helps with the ongoing efforts to globally enable -Warray-bounds
      and get us closer to being able to tighten the FORTIFY_SOURCE routines
      on memcpy().
      
      Link: https://github.com/KSPP/linux/issues/109
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Link: https://lore.kernel.org/lkml/d5ae2e65-1f18-2577-246f-bada7eee6ccd@intel.com/
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      87b569d1
    • Zheyu Ma's avatar
      video: fbdev: riva: Error out if 'pixclock' equals zero · ba0eded9
      Zheyu Ma authored
      [ Upstream commit f92763cb
      
       ]
      
      The userspace program could pass any values to the driver through
      ioctl() interface. If the driver doesn't check the value of 'pixclock',
      it may cause divide error.
      
      Fix this by checking whether 'pixclock' is zero first.
      
      The following log reveals it:
      
      [   33.396850] divide error: 0000 [#1] PREEMPT SMP KASAN PTI
      [   33.396864] CPU: 5 PID: 11754 Comm: i740 Not tainted 5.14.0-rc2-00513-gac532c9bbcfb-dirty #222
      [   33.396883] RIP: 0010:riva_load_video_mode+0x417/0xf70
      [   33.396969] Call Trace:
      [   33.396973]  ? debug_smp_processor_id+0x1c/0x20
      [   33.396984]  ? tick_nohz_tick_stopped+0x1a/0x90
      [   33.396996]  ? rivafb_copyarea+0x3c0/0x3c0
      [   33.397003]  ? wake_up_klogd.part.0+0x99/0xd0
      [   33.397014]  ? vprintk_emit+0x110/0x4b0
      [   33.397024]  ? vprintk_default+0x26/0x30
      [   33.397033]  ? vprintk+0x9c/0x1f0
      [   33.397041]  ? printk+0xba/0xed
      [   33.397054]  ? record_print_text.cold+0x16/0x16
      [   33.397063]  ? __kasan_check_read+0x11/0x20
      [   33.397074]  ? profile_tick+0xc0/0x100
      [   33.397084]  ? __sanitizer_cov_trace_const_cmp4+0x24/0x80
      [   33.397094]  ? riva_set_rop_solid+0x2a0/0x2a0
      [   33.397102]  rivafb_set_par+0xbe/0x610
      [   33.397111]  ? riva_set_rop_solid+0x2a0/0x2a0
      [   33.397119]  fb_set_var+0x5bf/0xeb0
      [   33.397127]  ? fb_blank+0x1a0/0x1a0
      [   33.397134]  ? lock_acquire+0x1ef/0x530
      [   33.397143]  ? lock_release+0x810/0x810
      [   33.397151]  ? lock_is_held_type+0x100/0x140
      [   33.397159]  ? ___might_sleep+0x1ee/0x2d0
      [   33.397170]  ? __mutex_lock+0x620/0x1190
      [   33.397180]  ? trace_hardirqs_on+0x6a/0x1c0
      [   33.397190]  do_fb_ioctl+0x31e/0x700
      
      Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/1627293835-17441-4-git-send-email-zheyuma97@gmail.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ba0eded9
    • Zheyu Ma's avatar
      video: fbdev: kyro: Error out if 'pixclock' equals zero · 85830b6c
      Zheyu Ma authored
      [ Upstream commit 1520b4b7
      
       ]
      
      The userspace program could pass any values to the driver through
      ioctl() interface. if the driver doesn't check the value of 'pixclock',
      it may cause divide error because the value of 'lineclock' and
      'frameclock' will be zero.
      
      Fix this by checking whether 'pixclock' is zero in kyrofb_check_var().
      
      The following log reveals it:
      
      [  103.073930] divide error: 0000 [#1] PREEMPT SMP KASAN PTI
      [  103.073942] CPU: 4 PID: 12483 Comm: syz-executor Not tainted 5.14.0-rc2-00478-g2734d6c1b1a0-dirty #118
      [  103.073959] RIP: 0010:kyrofb_set_par+0x316/0xc80
      [  103.074045] Call Trace:
      [  103.074048]  ? ___might_sleep+0x1ee/0x2d0
      [  103.074060]  ? kyrofb_ioctl+0x330/0x330
      [  103.074069]  fb_set_var+0x5bf/0xeb0
      [  103.074078]  ? fb_blank+0x1a0/0x1a0
      [  103.074085]  ? lock_acquire+0x3bd/0x530
      [  103.074094]  ? lock_release+0x810/0x810
      [  103.074103]  ? ___might_sleep+0x1ee/0x2d0
      [  103.074114]  ? __mutex_lock+0x620/0x1190
      [  103.074126]  ? trace_hardirqs_on+0x6a/0x1c0
      [  103.074137]  do_fb_ioctl+0x31e/0x700
      [  103.074144]  ? fb_getput_cmap+0x280/0x280
      [  103.074152]  ? rcu_read_lock_sched_held+0x11/0x80
      [  103.074162]  ? rcu_read_lock_sched_held+0x11/0x80
      [  103.074171]  ? __sanitizer_cov_trace_switch+0x67/0xf0
      [  103.074181]  ? __sanitizer_cov_trace_const_cmp2+0x20/0x80
      [  103.074191]  ? do_vfs_ioctl+0x14b/0x16c0
      [  103.074199]  ? vfs_fileattr_set+0xb60/0xb60
      [  103.074207]  ? rcu_read_lock_sched_held+0x11/0x80
      [  103.074216]  ? lock_release+0x483/0x810
      [  103.074224]  ? __fget_files+0x217/0x3d0
      [  103.074234]  ? __fget_files+0x239/0x3d0
      [  103.074243]  ? do_fb_ioctl+0x700/0x700
      [  103.074250]  fb_ioctl+0xe6/0x130
      
      Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/1627293835-17441-3-git-send-email-zheyuma97@gmail.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      85830b6c
    • Zheyu Ma's avatar
      video: fbdev: asiliantfb: Error out if 'pixclock' equals zero · eb7877f2
      Zheyu Ma authored
      [ Upstream commit b36b242d
      
       ]
      
      The userspace program could pass any values to the driver through
      ioctl() interface. If the driver doesn't check the value of 'pixclock',
      it may cause divide error.
      
      Fix this by checking whether 'pixclock' is zero first.
      
      The following log reveals it:
      
      [   43.861711] divide error: 0000 [#1] PREEMPT SMP KASAN PTI
      [   43.861737] CPU: 2 PID: 11764 Comm: i740 Not tainted 5.14.0-rc2-00513-gac532c9bbcfb-dirty #224
      [   43.861756] RIP: 0010:asiliantfb_check_var+0x4e/0x730
      [   43.861843] Call Trace:
      [   43.861848]  ? asiliantfb_remove+0x190/0x190
      [   43.861858]  fb_set_var+0x2e4/0xeb0
      [   43.861866]  ? fb_blank+0x1a0/0x1a0
      [   43.861873]  ? lock_acquire+0x1ef/0x530
      [   43.861884]  ? lock_release+0x810/0x810
      [   43.861892]  ? lock_is_held_type+0x100/0x140
      [   43.861903]  ? ___might_sleep+0x1ee/0x2d0
      [   43.861914]  ? __mutex_lock+0x620/0x1190
      [   43.861921]  ? do_fb_ioctl+0x313/0x700
      [   43.861929]  ? mutex_lock_io_nested+0xfa0/0xfa0
      [   43.861936]  ? __this_cpu_preempt_check+0x1d/0x30
      [   43.861944]  ? _raw_spin_unlock_irqrestore+0x46/0x60
      [   43.861952]  ? lockdep_hardirqs_on+0x59/0x100
      [   43.861959]  ? _raw_spin_unlock_irqrestore+0x46/0x60
      [   43.861967]  ? trace_hardirqs_on+0x6a/0x1c0
      [   43.861978]  do_fb_ioctl+0x31e/0x700
      
      Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/1627293835-17441-2-git-send-email-zheyuma97@gmail.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      eb7877f2
    • Johan Almbladh's avatar
      bpf/tests: Do not PASS tests without actually testing the result · e31ea11d
      Johan Almbladh authored
      [ Upstream commit 2b7e9f25
      
       ]
      
      Each test case can have a set of sub-tests, where each sub-test can
      run the cBPF/eBPF test snippet with its own data_size and expected
      result. Before, the end of the sub-test array was indicated by both
      data_size and result being zero. However, most or all of the internal
      eBPF tests has a data_size of zero already. When such a test also had
      an expected value of zero, the test was never run but reported as
      PASS anyway.
      
      Now the test runner always runs the first sub-test, regardless of the
      data_size and result values. The sub-test array zero-termination only
      applies for any additional sub-tests.
      
      There are other ways fix it of course, but this solution at least
      removes the surprise of eBPF tests with a zero result always succeeding.
      
      Signed-off-by: default avatarJohan Almbladh <johan.almbladh@anyfinetworks.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20210721103822.3755111-1-johan.almbladh@anyfinetworks.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e31ea11d
    • Johan Almbladh's avatar
      bpf/tests: Fix copy-and-paste error in double word test · 259ff727
      Johan Almbladh authored
      [ Upstream commit ae7f4704
      
       ]
      
      This test now operates on DW as stated instead of W, which was
      already covered by another test.
      
      Signed-off-by: default avatarJohan Almbladh <johan.almbladh@anyfinetworks.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20210721104058.3755254-1-johan.almbladh@anyfinetworks.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      259ff727
    • Zheyu Ma's avatar
      tty: serial: jsm: hold port lock when reporting modem line changes · 16778261
      Zheyu Ma authored
      [ Upstream commit 240e126c
      
       ]
      
      uart_handle_dcd_change() requires a port lock to be held and will emit a
      warning when lockdep is enabled.
      
      Held corresponding lock to fix the following warnings.
      
      [  132.528648] WARNING: CPU: 5 PID: 11600 at drivers/tty/serial/serial_core.c:3046 uart_handle_dcd_change+0xf4/0x120
      [  132.530482] Modules linked in:
      [  132.531050] CPU: 5 PID: 11600 Comm: jsm Not tainted 5.14.0-rc1-00003-g7fef2edf7cc7-dirty #31
      [  132.535268] RIP: 0010:uart_handle_dcd_change+0xf4/0x120
      [  132.557100] Call Trace:
      [  132.557562]  ? __free_pages+0x83/0xb0
      [  132.558213]  neo_parse_modem+0x156/0x220
      [  132.558897]  neo_param+0x399/0x840
      [  132.559495]  jsm_tty_open+0x12f/0x2d0
      [  132.560131]  uart_startup.part.18+0x153/0x340
      [  132.560888]  ? lock_is_held_type+0xe9/0x140
      [  132.561660]  uart_port_activate+0x7f/0xe0
      [  132.562351]  ? uart_startup.part.18+0x340/0x340
      [  132.563003]  tty_port_open+0x8d/0xf0
      [  132.563523]  ? uart_set_options+0x1e0/0x1e0
      [  132.564125]  uart_open+0x24/0x40
      [  132.564604]  tty_open+0x15c/0x630
      
      Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Link: https://lore.kernel.org/r/1626242003-3809-1-git-send-email-zheyuma97@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      16778261
    • Maciej Żenczykowski's avatar
      usb: gadget: u_ether: fix a potential null pointer dereference · 15c82136
      Maciej Żenczykowski authored
      [ Upstream commit 8ae01239
      
       ]
      
      f_ncm tx timeout can call us with null skb to flush
      a pending frame.  In this case skb is NULL to begin
      with but ceases to be null after dev->wrap() completes.
      
      In such a case in->maxpacket will be read, even though
      we've failed to check that 'in' is not NULL.
      
      Though I've never observed this fail in practice,
      however the 'flush operation' simply does not make sense with
      a null usb IN endpoint - there's nowhere to flush to...
      (note that we're the gadget/device, and IN is from the point
       of view of the host, so here IN actually means outbound...)
      
      Cc: Brooke Basile <brookebasile@gmail.com>
      Cc: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
      Link: https://lore.kernel.org/r/20210701114834.884597-6-zenczykowski@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      15c82136
    • Kelly Devilliv's avatar
      usb: host: fotg210: fix the actual_length of an iso packet · 36415d6a
      Kelly Devilliv authored
      [ Upstream commit 091cb2f7
      
       ]
      
      We should acquire the actual_length of an iso packet
      from the iTD directly using FOTG210_ITD_LENGTH() macro.
      
      Signed-off-by: default avatarKelly Devilliv <kelly.devilliv@gmail.com>
      Link: https://lore.kernel.org/r/20210627125747.127646-4-kelly.devilliv@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      36415d6a
    • Tianjia Zhang's avatar
      Smack: Fix wrong semantics in smk_access_entry() · 5aa1de33
      Tianjia Zhang authored
      [ Upstream commit 6d14f5c7
      
       ]
      
      In the smk_access_entry() function, if no matching rule is found
      in the rust_list, a negative error code will be used to perform bit
      operations with the MAY_ enumeration value. This is semantically
      wrong. This patch fixes this issue.
      
      Signed-off-by: default avatarTianjia Zhang <tianjia.zhang@linux.alibaba.com>
      Signed-off-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5aa1de33
    • Yajun Deng's avatar
      netlink: Deal with ESRCH error in nlmsg_notify() · b4c76419
      Yajun Deng authored
      [ Upstream commit fef773fc ]
      
      Yonghong Song report:
      The bpf selftest tc_bpf failed with latest bpf-next.
      The following is the command to run and the result:
      $ ./test_progs -n 132
      [   40.947571] bpf_testmod: loading out-of-tree module taints kernel.
      test_tc_bpf:PASS:test_tc_bpf__open_and_load 0 nsec
      test_tc_bpf:PASS:bpf_tc_hook_create(BPF_TC_INGRESS) 0 nsec
      test_tc_bpf:PASS:bpf_tc_hook_create invalid hook.attach_point 0 nsec
      test_tc_bpf_basic:PASS:bpf_obj_get_info_by_fd 0 nsec
      test_tc_bpf_basic:PASS:bpf_tc_attach 0 nsec
      test_tc_bpf_basic:PASS:handle set 0 nsec
      test_tc_bpf_basic:PASS:priority set 0 nsec
      test_tc_bpf_basic:PASS:prog_id set 0 nsec
      test_tc_bpf_basic:PASS:bpf_tc_attach replace mode 0 nsec
      test_tc_bpf_basic:PASS:bpf_tc_query 0 nsec
      test_tc_bpf_basic:PASS:handle set 0 nsec
      test_tc_bpf_basic:PASS:priority set 0 nsec
      test_tc_bpf_basic:PASS:prog_id set 0 nsec
      libbpf: Kernel error message: Failed to send filter delete notification
      test_tc_bpf_basic:FAIL:bpf_tc_detach unexpected error: -3 (errno 3)
      test_tc_bpf:FAIL:test_tc_internal ingress unexpected error: -3 (errno 3)
      
      The failure seems due to the commit
          cfdf0d9a
      
       ("rtnetlink: use nlmsg_notify() in rtnetlink_send()")
      
      Deal with ESRCH error in nlmsg_notify() even the report variable is zero.
      
      Reported-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarYajun Deng <yajun.deng@linux.dev>
      Link: https://lore.kernel.org/r/20210719051816.11762-1-yajun.deng@linux.dev
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b4c76419
    • Zheyu Ma's avatar
      video: fbdev: kyro: fix a DoS bug by restricting user input · 751d71e2
      Zheyu Ma authored
      [ Upstream commit 98a65439
      
       ]
      
      The user can pass in any value to the driver through the 'ioctl'
      interface. The driver dost not check, which may cause DoS bugs.
      
      The following log reveals it:
      
      divide error: 0000 [#1] PREEMPT SMP KASAN PTI
      RIP: 0010:SetOverlayViewPort+0x133/0x5f0 drivers/video/fbdev/kyro/STG4000OverlayDevice.c:476
      Call Trace:
       kyro_dev_overlay_viewport_set drivers/video/fbdev/kyro/fbdev.c:378 [inline]
       kyrofb_ioctl+0x2eb/0x330 drivers/video/fbdev/kyro/fbdev.c:603
       do_fb_ioctl+0x1f3/0x700 drivers/video/fbdev/core/fbmem.c:1171
       fb_ioctl+0xeb/0x130 drivers/video/fbdev/core/fbmem.c:1185
       vfs_ioctl fs/ioctl.c:48 [inline]
       __do_sys_ioctl fs/ioctl.c:753 [inline]
       __se_sys_ioctl fs/ioctl.c:739 [inline]
       __x64_sys_ioctl+0x19b/0x220 fs/ioctl.c:739
       do_syscall_64+0x32/0x80 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/1626235762-2590-1-git-send-email-zheyuma97@gmail.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      751d71e2
    • Jonathan Cameron's avatar
      iio: dac: ad5624r: Fix incorrect handling of an optional regulator. · 1382eae1
      Jonathan Cameron authored
      [ Upstream commit 97683c85
      
       ]
      
      The naming of the regulator is problematic.  VCC is usually a supply
      voltage whereas these devices have a separate VREF pin.
      
      Secondly, the regulator core might have provided a stub regulator if
      a real regulator wasn't provided. That would in turn have failed to
      provide a voltage when queried. So reality was that there was no way
      to use the internal reference.
      
      In order to avoid breaking any dts out in the wild, make sure to fallback
      to the original vcc naming if vref is not available.
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Acked-by: default avatarNuno Sá <nuno.sa@analog.com>
      Link: https://lore.kernel.org/r/20210627163244.1090296-9-jic23@kernel.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1382eae1
    • Rafael J. Wysocki's avatar
      PCI: Use pci_update_current_state() in pci_enable_device_flags() · c767ab61
      Rafael J. Wysocki authored
      [ Upstream commit 14858dcc
      
       ]
      
      Updating the current_state field of struct pci_dev the way it is done
      in pci_enable_device_flags() before calling do_pci_enable_device() may
      not work.  For example, if the given PCI device depends on an ACPI
      power resource whose _STA method initially returns 0 ("off"), but the
      config space of the PCI device is accessible and the power state
      retrieved from the PCI_PM_CTRL register is D0, the current_state
      field in the struct pci_dev representing that device will get out of
      sync with the power.state of its ACPI companion object and that will
      lead to power management issues going forward.
      
      To avoid such issues, make pci_enable_device_flags() call
      pci_update_current_state() which takes ACPI device power management
      into account, if present, to retrieve the current power state of the
      device.
      
      Link: https://lore.kernel.org/lkml/20210314000439.3138941-1-luzmaximilian@gmail.com/
      Reported-by: default avatarMaximilian Luz <luzmaximilian@gmail.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: default avatarMaximilian Luz <luzmaximilian@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c767ab61
    • Sean Anderson's avatar
      crypto: mxs-dcp - Use sg_mapping_iter to copy data · 66cc9110
      Sean Anderson authored
      [ Upstream commit 2e6d793e
      
       ]
      
      This uses the sg_pcopy_from_buffer to copy data, instead of doing it
      ourselves.
      
      In addition to reducing code size, this fixes the following oops
      resulting from failing to kmap the page:
      
      [   68.896381] Unable to handle kernel NULL pointer dereference at virtual address 00000ab8
      [   68.904539] pgd = 3561adb3
      [   68.907475] [00000ab8] *pgd=00000000
      [   68.911153] Internal error: Oops: 805 [#1] ARM
      [   68.915618] Modules linked in: cfg80211 rfkill des_generic libdes arc4 libarc4 cbc ecb algif_skcipher sha256_generic libsha256 sha1_generic hmac aes_generic libaes cmac sha512_generic md5 md4 algif_hash af_alg i2c_imx i2c_core ci_hdrc_imx ci_hdrc mxs_dcp ulpi roles udc_core imx_sdma usbmisc_imx usb_common firmware_class virt_dma phy_mxs_usb nf_tables nfnetlink ip_tables x_tables ipv6 autofs4
      [   68.950741] CPU: 0 PID: 139 Comm: mxs_dcp_chan/ae Not tainted 5.10.34 #296
      [   68.958501] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
      [   68.964710] PC is at memcpy+0xa8/0x330
      [   68.968479] LR is at 0xd7b2bc9d
      [   68.971638] pc : [<c053e7c8>]    lr : [<d7b2bc9d>]    psr: 000f0013
      [   68.977920] sp : c2cbbee4  ip : 00000010  fp : 00000010
      [   68.983159] r10: 00000000  r9 : c3283a40  r8 : 1a5a6f08
      [   68.988402] r7 : 4bfe0ecc  r6 : 76d8a220  r5 : c32f9050  r4 : 00000001
      [   68.994945] r3 : 00000ab8  r2 : fffffff0  r1 : c32f9050  r0 : 00000ab8
      [   69.001492] Flags: nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
      [   69.008646] Control: 10c53c7d  Table: 83664059  DAC: 00000051
      [   69.014414] Process mxs_dcp_chan/ae (pid: 139, stack limit = 0x667b57ab)
      [   69.021133] Stack: (0xc2cbbee4 to 0xc2cbc000)
      [   69.025519] bee0:          c32f9050 c3235408 00000010 00000010 00000ab8 00000001 bf10406c
      [   69.033720] bf00: 00000000 00000000 00000010 00000000 c32355d0 832fb080 00000000 c13de2fc
      [   69.041921] bf20: c3628010 00000010 c33d5780 00000ab8 bf1067e8 00000002 c21e5010 c2cba000
      [   69.050125] bf40: c32f8040 00000000 bf106a40 c32f9040 c3283a80 00000001 bf105240 c3234040
      [   69.058327] bf60: ffffe000 c3204100 c2c69800 c2cba000 00000000 bf103b84 00000000 c2eddc54
      [   69.066530] bf80: c3204144 c0140d1c c2cba000 c2c69800 c0140be8 00000000 00000000 00000000
      [   69.074730] bfa0: 00000000 00000000 00000000 c0100114 00000000 00000000 00000000 00000000
      [   69.082932] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [   69.091131] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
      [   69.099364] [<c053e7c8>] (memcpy) from [<bf10406c>] (dcp_chan_thread_aes+0x4e8/0x840 [mxs_dcp])
      [   69.108117] [<bf10406c>] (dcp_chan_thread_aes [mxs_dcp]) from [<c0140d1c>] (kthread+0x134/0x160)
      [   69.116941] [<c0140d1c>] (kthread) from [<c0100114>] (ret_from_fork+0x14/0x20)
      [   69.124178] Exception stack(0xc2cbbfb0 to 0xc2cbbff8)
      [   69.129250] bfa0:                                     00000000 00000000 00000000 00000000
      [   69.137450] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [   69.145648] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
      [   69.152289] Code: e320f000 e4803004 e4804004 e4805004 (e4806004)
      
      Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      66cc9110
    • Zhen Lei's avatar
      pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry() · 0fda79d3
      Zhen Lei authored
      [ Upstream commit d789a490 ]
      
      Fix to return -ENOTSUPP instead of 0 when PCS_HAS_PINCONF is true, which
      is the same as that returned in pcs_parse_pinconf().
      
      Fixes: 4e7e8017
      
       ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules")
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
      Link: https://lore.kernel.org/r/20210722033930.4034-2-thunder.leizhen@huawei.com
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0fda79d3
    • Randy Dunlap's avatar
      openrisc: don't printk() unconditionally · 0b7dd6d4
      Randy Dunlap authored
      [ Upstream commit 946e1052 ]
      
      Don't call printk() when CONFIG_PRINTK is not set.
      Fixes the following build errors:
      
      or1k-linux-ld: arch/openrisc/kernel/entry.o: in function `_external_irq_handler':
      (.text+0x804): undefined reference to `printk'
      (.text+0x804): relocation truncated to fit: R_OR1K_INSN_REL_26 against undefined symbol `printk'
      
      Fixes: 9d02a428
      
       ("OpenRISC: Boot code")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: openrisc@lists.librecores.org
      Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0b7dd6d4
    • Krzysztof Wilczyński's avatar
      PCI: Return ~0 data on pciconfig_read() CAP_SYS_ADMIN failure · b9e9c639
      Krzysztof Wilczyński authored
      commit a8bd29bd upstream.
      
      The pciconfig_read() syscall reads PCI configuration space using
      hardware-dependent config accessors.
      
      If the read fails on PCI, most accessors don't return an error; they
      pretend the read was successful and got ~0 data from the device, so the
      syscall returns success with ~0 data in the buffer.
      
      When the accessor does return an error, pciconfig_read() normally fills the
      user's buffer with ~0 and returns an error in errno.  But after
      e4585da2 ("pci syscall.c: Switch to refcounting API"), we don't fill
      the buffer with ~0 for the EPERM "user lacks CAP_SYS_ADMIN" error.
      
      Userspace may rely on the ~0 data to detect errors, but after e4585da2,
      that would not detect CAP_SYS_ADMIN errors.
      
      Restore the original behaviour of filling the buffer with ~0 when the
      CAP_SYS_ADMIN check fails.
      
      [bhelgaas: commit log, fold in Nathan's fix
      https://lore.kernel.org/r/20210803200836.500658-1-nathan@kernel.org]
      Fixes: e4585da2
      
       ("pci syscall.c: Switch to refcounting API")
      Link: https://lore.kernel.org/r/20210729233755.1509616-1-kw@linux.com
      Signed-off-by: default avatarKrzysztof Wilczyński <kw@linux.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b9e9c639
    • Marek Behún's avatar
      PCI: Restrict ASMedia ASM1062 SATA Max Payload Size Supported · 39ac71ca
      Marek Behún authored
      commit b12d93e9
      
       upstream.
      
      The ASMedia ASM1062 SATA controller advertises Max_Payload_Size_Supported
      of 512, but in fact it cannot handle incoming TLPs with payload size of
      512.
      
      We discovered this issue on PCIe controllers capable of MPS = 512 (Aardvark
      and DesignWare), where the issue presents itself as an External Abort.
      Bjorn Helgaas says:
      
        Probably ASM1062 reports a Malformed TLP error when it receives a data
        payload of 512 bytes, and Aardvark, DesignWare, etc convert this to an
        arm64 External Abort. [1]
      
      To avoid this problem, limit the ASM1062 Max Payload Size Supported to 256
      bytes, so we set the Max Payload Size of devices that may send TLPs to the
      ASM1062 to 256 or less.
      
      [1] https://lore.kernel.org/linux-pci/20210601170907.GA1949035@bjorn-Precision-5520/
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212695
      Link: https://lore.kernel.org/r/20210624171418.27194-2-kabel@kernel.org
      Reported-by: default avatarRötti <espressobinboardarmbiantempmailaddress@posteo.de>
      Signed-off-by: default avatarMarek Behún <kabel@kernel.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarKrzysztof Wilczyński <kw@linux.com>
      Reviewed-by: default avatarPali Rohár <pali@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      39ac71ca
    • David Heidelberg's avatar
      ARM: 9105/1: atags_to_fdt: don't warn about stack size · d1fa1754
      David Heidelberg authored
      commit b30d0289
      
       upstream.
      
      The merge_fdt_bootargs() function by definition consumes more than 1024
      bytes of stack because it has a 1024 byte command line on the stack,
      meaning that we always get a warning when building this file:
      
      arch/arm/boot/compressed/atags_to_fdt.c: In function 'merge_fdt_bootargs':
      arch/arm/boot/compressed/atags_to_fdt.c:98:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]
      
      However, as this is the decompressor and we know that it has a very shallow
      call chain, and we do not actually risk overflowing the kernel stack
      at runtime here.
      
      This just shuts up the warning by disabling the warning flag for this
      file.
      
      Tested on Nexus 7 2012 builds.
      
      Acked-by: default avatarNicolas Pitre <nico@fluxnic.net>
      Signed-off-by: default avatarDavid Heidelberg <david@ixit.cz>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d1fa1754
    • Hans de Goede's avatar
      libata: add ATA_HORKAGE_NO_NCQ_TRIM for Samsung 860 and 870 SSDs · 92f1f81c
      Hans de Goede authored
      commit 8a6430ab upstream.
      
      Commit ca6bfcb2 ("libata: Enable queued TRIM for Samsung SSD 860")
      limited the existing ATA_HORKAGE_NO_NCQ_TRIM quirk from "Samsung SSD 8*",
      covering all Samsung 800 series SSDs, to only apply to "Samsung SSD 840*"
      and "Samsung SSD 850*" series based on information from Samsung.
      
      But there is a large number of users which is still reporting issues
      with the Samsung 860 and 870 SSDs combined with Intel, ASmedia or
      Marvell SATA controllers and all reporters also report these problems
      going away when disabling queued trims.
      
      Note that with AMD SATA controllers users are reporting even worse
      issues and only completely disabling NCQ helps there, this will be
      addressed in a separate patch.
      
      Fixes: ca6bfcb2
      
       ("libata: Enable queued TRIM for Samsung SSD 860")
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=203475
      Cc: stable@vger.kernel.org
      Cc: Kate Hsuan <hpa@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Link: https://lore.kernel.org/r/20210823095220.30157-1-hdegoede@redhat.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      92f1f81c