Skip to content
  1. Apr 16, 2021
  2. Apr 10, 2021
    • Greg Kroah-Hartman's avatar
      Linux 4.14.230 · 958e517f
      Greg Kroah-Hartman authored
      
      
      Tested-by: default avatarJason Self <jason@bluehome.net>
      Tested-by: default avatarLinux Kernel Functional Testing <lkft@linaro.org>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Link: https://lore.kernel.org/r/20210409095300.391558233@linuxfoundation.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      v4.14.230
      958e517f
    • Angelo Dureghello's avatar
      can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate · 1bba2685
      Angelo Dureghello authored
      commit 47c5e474 upstream.
      
      For cases when flexcan is built-in, bitrate is still not set at
      registering. So flexcan_chip_freeze() generates:
      
      [    1.860000] *** ZERO DIVIDE ***   FORMAT=4
      [    1.860000] Current process id is 1
      [    1.860000] BAD KERNEL TRAP: 00000000
      [    1.860000] PC: [<402e70c8>] flexcan_chip_freeze+0x1a/0xa8
      
      To allow chip freeze, using an hardcoded timeout when bitrate is still
      not set.
      
      Fixes: ec15e27c
      
       ("can: flexcan: enable RX FIFO after FRZ/HALT valid")
      Link: https://lore.kernel.org/r/20210315231510.650593-1-angelo@kernel-space.org
      Signed-off-by: default avatarAngelo Dureghello <angelo@kernel-space.org>
      [mkl: use if instead of ? operator]
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Cc: Koen Vandeputte <koen.vandeputte@citymesh.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1bba2685
    • Masahiro Yamada's avatar
      init/Kconfig: make COMPILE_TEST depend on HAS_IOMEM · 4086850f
      Masahiro Yamada authored
      commit ea29b20a upstream.
      
      I read the commit log of the following two:
      
      - bc083a64 ("init/Kconfig: make COMPILE_TEST depend on !UML")
      - 334ef6ed
      
       ("init/Kconfig: make COMPILE_TEST depend on !S390")
      
      Both are talking about HAS_IOMEM dependency missing in many drivers.
      
      So, 'depends on HAS_IOMEM' seems the direct, sensible solution to me.
      
      This does not change the behavior of UML. UML still cannot enable
      COMPILE_TEST because it does not provide HAS_IOMEM.
      
      The current dependency for S390 is too strong. Under the condition of
      CONFIG_PCI=y, S390 provides HAS_IOMEM, hence can enable COMPILE_TEST.
      
      I also removed the meaningless 'default n'.
      
      Link: https://lkml.kernel.org/r/20210224140809.1067582-1-masahiroy@kernel.org
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Arnd Bergmann <arnd@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: KP Singh <kpsingh@google.com>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Quentin Perret <qperret@google.com>
      Cc: Valentin Schneider <valentin.schneider@arm.com>
      Cc: "Enrico Weigelt, metux IT consult" <lkml@metux.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4086850f
    • Heiko Carstens's avatar
      init/Kconfig: make COMPILE_TEST depend on !S390 · fa426149
      Heiko Carstens authored
      commit 334ef6ed upstream.
      
      While allmodconfig and allyesconfig build for s390 there are also
      various bots running compile tests with randconfig, where PCI is
      disabled. This reveals that a lot of drivers should actually depend on
      HAS_IOMEM.
      Adding this to each device driver would be a never ending story,
      therefore just disable COMPILE_TEST for s390.
      
      The reasoning is more or less the same as described in
      commit bc083a64
      
       ("init/Kconfig: make COMPILE_TEST depend on !UML").
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Suggested-by: default avatarArnd Bergmann <arnd@kernel.org>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fa426149
    • Piotr Krysiuk's avatar
      bpf, x86: Validate computation of branch displacements for x86-64 · 32f9a870
      Piotr Krysiuk authored
      commit e4d4d456
      
       upstream.
      
      The branch displacement logic in the BPF JIT compilers for x86 assumes
      that, for any generated branch instruction, the distance cannot
      increase between optimization passes.
      
      But this assumption can be violated due to how the distances are
      computed. Specifically, whenever a backward branch is processed in
      do_jit(), the distance is computed by subtracting the positions in the
      machine code from different optimization passes. This is because part
      of addrs[] is already updated for the current optimization pass, before
      the branch instruction is visited.
      
      And so the optimizer can expand blocks of machine code in some cases.
      
      This can confuse the optimizer logic, where it assumes that a fixed
      point has been reached for all machine code blocks once the total
      program size stops changing. And then the JIT compiler can output
      abnormal machine code containing incorrect branch displacements.
      
      To mitigate this issue, we assert that a fixed point is reached while
      populating the output image. This rejects any problematic programs.
      The issue affects both x86-32 and x86-64. We mitigate separately to
      ease backporting.
      
      Signed-off-by: default avatarPiotr Krysiuk <piotras@gmail.com>
      Reviewed-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      32f9a870
    • Vincent Whitchurch's avatar
      cifs: Silently ignore unknown oplock break handle · fee67e93
      Vincent Whitchurch authored
      [ Upstream commit 219481a8
      
       ]
      
      Make SMB2 not print out an error when an oplock break is received for an
      unknown handle, similar to SMB1.  The debug message which is printed for
      these unknown handles may also be misleading, so fix that too.
      
      The SMB2 lease break path is not affected by this patch.
      
      Without this, a program which writes to a file from one thread, and
      opens, reads, and writes the same file from another thread triggers the
      below errors several times a minute when run against a Samba server
      configured with "smb2 leases = no".
      
       CIFS: VFS: \\192.168.0.1 No task to wake, unknown frame received! NumMids 2
       00000000: 424d53fe 00000040 00000000 00000012  .SMB@...........
       00000010: 00000001 00000000 ffffffff ffffffff  ................
       00000020: 00000000 00000000 00000000 00000000  ................
       00000030: 00000000 00000000 00000000 00000000  ................
      
      Signed-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
      Reviewed-by: default avatarTom Talpey <tom@talpey.com>
      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>
      fee67e93
    • Ronnie Sahlberg's avatar
      cifs: revalidate mapping when we open files for SMB1 POSIX · 9e62e366
      Ronnie Sahlberg authored
      [ Upstream commit cee8f4f6
      
       ]
      
      RHBZ: 1933527
      
      Under SMB1 + POSIX, if an inode is reused on a server after we have read and
      cached a part of a file, when we then open the new file with the
      re-cycled inode there is a chance that we may serve the old data out of cache
      to the application.
      This only happens for SMB1 (deprecated) and when posix are used.
      The simplest solution to avoid this race is to force a revalidate
      on smb1-posix open.
      
      Signed-off-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      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>
      9e62e366
    • Sergei Trofimovich's avatar
      ia64: mca: allocate early mca with GFP_ATOMIC · 12e4976f
      Sergei Trofimovich authored
      [ Upstream commit f2a419cf
      
       ]
      
      The sleep warning happens at early boot right at secondary CPU
      activation bootup:
      
          smp: Bringing up secondary CPUs ...
          BUG: sleeping function called from invalid context at mm/page_alloc.c:4942
          in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1
          CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.12.0-rc2-00007-g79e228d0b611-dirty #99
          ..
          Call Trace:
            show_stack+0x90/0xc0
            dump_stack+0x150/0x1c0
            ___might_sleep+0x1c0/0x2a0
            __might_sleep+0xa0/0x160
            __alloc_pages_nodemask+0x1a0/0x600
            alloc_page_interleave+0x30/0x1c0
            alloc_pages_current+0x2c0/0x340
            __get_free_pages+0x30/0xa0
            ia64_mca_cpu_init+0x2d0/0x3a0
            cpu_init+0x8b0/0x1440
            start_secondary+0x60/0x700
            start_ap+0x750/0x780
          Fixed BSP b0 value from CPU 1
      
      As I understand interrupts are not enabled yet and system has a lot of
      memory.  There is little chance to sleep and switch to GFP_ATOMIC should
      be a no-op.
      
      Link: https://lkml.kernel.org/r/20210315085045.204414-1-slyfox@gentoo.org
      Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      12e4976f
    • Martin Wilck's avatar
      scsi: target: pscsi: Clean up after failure in pscsi_map_sg() · a9222463
      Martin Wilck authored
      [ Upstream commit 36fa766f
      
       ]
      
      If pscsi_map_sg() fails, make sure to drop references to already allocated
      bios.
      
      Link: https://lore.kernel.org/r/20210323212431.15306-2-mwilck@suse.com
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarLee Duncan <lduncan@suse.com>
      Signed-off-by: default avatarMartin Wilck <mwilck@suse.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a9222463
    • Arnd Bergmann's avatar
      x86/build: Turn off -fcf-protection for realmode targets · 533dbcdc
      Arnd Bergmann authored
      [ Upstream commit 9fcb51c1
      
       ]
      
      The new Ubuntu GCC packages turn on -fcf-protection globally,
      which causes a build failure in the x86 realmode code:
      
        cc1: error: ‘-fcf-protection’ is not compatible with this target
      
      Turn it off explicitly on compilers that understand this option.
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20210323124846.1584944-1-arnd@kernel.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      533dbcdc
    • Esteve Varela Colominas's avatar
      platform/x86: thinkpad_acpi: Allow the FnLock LED to change state · c36b82c4
      Esteve Varela Colominas authored
      [ Upstream commit 3d677f12
      
       ]
      
      On many recent ThinkPad laptops, there's a new LED next to the ESC key,
      that indicates the FnLock status.
      When the Fn+ESC combo is pressed, FnLock is toggled, which causes the
      Media Key functionality to change, making it so that the media keys
      either perform their media key function, or function as an F-key by
      default. The Fn key can be used the access the alternate function at any
      time.
      
      With the current linux kernel, the LED doens't change state if you press
      the Fn+ESC key combo. However, the media key functionality *does*
      change. This is annoying, since the LED will stay on if it was on during
      bootup, and it makes it hard to keep track what the current state of the
      FnLock is.
      
      This patch calls an ACPI function, that gets the current media key
      state, when the Fn+ESC key combo is pressed. Through testing it was
      discovered that this function causes the LED to update correctly to
      reflect the current state when this function is called.
      
      The relevant ACPI calls are the following:
      \_SB_.PCI0.LPC0.EC0_.HKEY.GMKS: Get media key state, returns 0x603 if the FnLock mode is enabled, and 0x602 if it's disabled.
      \_SB_.PCI0.LPC0.EC0_.HKEY.SMKS: Set media key state, sending a 1 will enable FnLock mode, and a 0 will disable it.
      
      Relevant discussion:
      https://bugzilla.kernel.org/show_bug.cgi?id=207841
      https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1881015
      
      Signed-off-by: default avatarEsteve Varela Colominas <esteve.varela@gmail.com>
      Link: https://lore.kernel.org/r/20210315195823.23212-1-esteve.varela@gmail.com
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c36b82c4
    • Rob Clark's avatar
      drm/msm: Ratelimit invalid-fence message · 0865d928
      Rob Clark authored
      [ Upstream commit 7ad48d27
      
       ]
      
      We have seen a couple cases where low memory situations cause something
      bad to happen, followed by a flood of these messages obscuring the root
      cause.  Lets ratelimit the dmesg spam so that next time it happens we
      don't lose the kernel traces leading up to this.
      
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0865d928
    • Karthikeyan Kathirvel's avatar
      mac80211: choose first enabled channel for monitor · d601353c
      Karthikeyan Kathirvel authored
      [ Upstream commit 041c881a
      
       ]
      
      Even if the first channel from sband channel list is invalid
      or disabled mac80211 ends up choosing it as the default channel
      for monitor interfaces, making them not usable.
      
      Fix this by assigning the first available valid or enabled
      channel instead.
      
      Signed-off-by: default avatarKarthikeyan Kathirvel <kathirve@codeaurora.org>
      Link: https://lore.kernel.org/r/1615440547-7661-1-git-send-email-kathirve@codeaurora.org
      [reword commit message, comment, code cleanups]
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d601353c
    • Tong Zhang's avatar
      mISDN: fix crash in fritzpci · f2600b3e
      Tong Zhang authored
      [ Upstream commit a9f81244
      
       ]
      
      setup_fritz() in avmfritz.c might fail with -EIO and in this case the
      isac.type and isac.write_reg is not initialized and remains 0(NULL).
      A subsequent call to isac_release() will dereference isac->write_reg and
      crash.
      
      [    1.737444] BUG: kernel NULL pointer dereference, address: 0000000000000000
      [    1.737809] #PF: supervisor instruction fetch in kernel mode
      [    1.738106] #PF: error_code(0x0010) - not-present page
      [    1.738378] PGD 0 P4D 0
      [    1.738515] Oops: 0010 [#1] SMP NOPTI
      [    1.738711] CPU: 0 PID: 180 Comm: systemd-udevd Not tainted 5.12.0-rc2+ #78
      [    1.739077] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-48-gd9c812dda519-p
      rebuilt.qemu.org 04/01/2014
      [    1.739664] RIP: 0010:0x0
      [    1.739807] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
      [    1.740200] RSP: 0018:ffffc9000027ba10 EFLAGS: 00010202
      [    1.740478] RAX: 0000000000000000 RBX: ffff888102f41840 RCX: 0000000000000027
      [    1.740853] RDX: 00000000000000ff RSI: 0000000000000020 RDI: ffff888102f41800
      [    1.741226] RBP: ffffc9000027ba20 R08: ffff88817bc18440 R09: ffffc9000027b808
      [    1.741600] R10: 0000000000000001 R11: 0000000000000001 R12: ffff888102f41840
      [    1.741976] R13: 00000000fffffffb R14: ffff888102f41800 R15: ffff8881008b0000
      [    1.742351] FS:  00007fda3a38a8c0(0000) GS:ffff88817bc00000(0000) knlGS:0000000000000000
      [    1.742774] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [    1.743076] CR2: ffffffffffffffd6 CR3: 00000001021ec000 CR4: 00000000000006f0
      [    1.743452] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [    1.743828] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [    1.744206] Call Trace:
      [    1.744339]  isac_release+0xcc/0xe0 [mISDNipac]
      [    1.744582]  fritzpci_probe.cold+0x282/0x739 [avmfritz]
      [    1.744861]  local_pci_probe+0x48/0x80
      [    1.745063]  pci_device_probe+0x10f/0x1c0
      [    1.745278]  really_probe+0xfb/0x420
      [    1.745471]  driver_probe_device+0xe9/0x160
      [    1.745693]  device_driver_attach+0x5d/0x70
      [    1.745917]  __driver_attach+0x8f/0x150
      [    1.746123]  ? device_driver_attach+0x70/0x70
      [    1.746354]  bus_for_each_dev+0x7e/0xc0
      [    1.746560]  driver_attach+0x1e/0x20
      [    1.746751]  bus_add_driver+0x152/0x1f0
      [    1.746957]  driver_register+0x74/0xd0
      [    1.747157]  ? 0xffffffffc00d8000
      [    1.747334]  __pci_register_driver+0x54/0x60
      [    1.747562]  AVM_init+0x36/0x1000 [avmfritz]
      [    1.747791]  do_one_initcall+0x48/0x1d0
      [    1.747997]  ? __cond_resched+0x19/0x30
      [    1.748206]  ? kmem_cache_alloc_trace+0x390/0x440
      [    1.748458]  ? do_init_module+0x28/0x250
      [    1.748669]  do_init_module+0x62/0x250
      [    1.748870]  load_module+0x23ee/0x26a0
      [    1.749073]  __do_sys_finit_module+0xc2/0x120
      [    1.749307]  ? __do_sys_finit_module+0xc2/0x120
      [    1.749549]  __x64_sys_finit_module+0x1a/0x20
      [    1.749782]  do_syscall_64+0x38/0x90
      
      Signed-off-by: default avatarTong Zhang <ztong0001@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f2600b3e
    • Pavel Andrianov's avatar
      net: pxa168_eth: Fix a potential data race in pxa168_eth_remove · 25c101b6
      Pavel Andrianov authored
      [ Upstream commit 0571a753
      
       ]
      
      pxa168_eth_remove() firstly calls unregister_netdev(),
      then cancels a timeout work. unregister_netdev() shuts down a device
      interface and removes it from the kernel tables. If the timeout occurs
      in parallel, the timeout work (pxa168_eth_tx_timeout_task) performs stop
      and open of the device. It may lead to an inconsistent state and memory
      leaks.
      
      Found by Linux Driver Verification project (linuxtesting.org).
      
      Signed-off-by: default avatarPavel Andrianov <andrianov@ispras.ru>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      25c101b6
    • Mans Rullgard's avatar
      ARM: dts: am33xx: add aliases for mmc interfaces · 7c12753c
      Mans Rullgard authored
      [ Upstream commit 9bbce32a ]
      
      Without DT aliases, the numbering of mmc interfaces is unpredictable.
      Adding them makes it possible to refer to devices consistently.  The
      popular suggestion to use UUIDs obviously doesn't work with a blank
      device fresh from the factory.
      
      See commit fa2d0aa9
      
       ("mmc: core: Allow setting slot index via
      device tree alias") for more discussion.
      
      Signed-off-by: default avatarMans Rullgard <mans@mansr.com>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7c12753c
  3. Apr 07, 2021
    • Greg Kroah-Hartman's avatar
      Linux 4.14.229 · 0cc24401
      Greg Kroah-Hartman authored
      
      
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarJason Self <jason@bluehome.net>
      Tested-by: default avatarLinux Kernel Functional Testing <lkft@linaro.org>
      Tested-by: default avatarHulk Robot <hulkrobot@huawei.com>
      Tested-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Link: https://lore.kernel.org/r/20210405085021.996963957@linuxfoundation.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      v4.14.229
      0cc24401
    • Du Cheng's avatar
      drivers: video: fbcon: fix NULL dereference in fbcon_cursor() · 1e353852
      Du Cheng authored
      commit 01faae51
      
       upstream.
      
      add null-check on function pointer before dereference on ops->cursor
      
      Reported-by: default avatar <syzbot+b67aaae8d3a927f68d20@syzkaller.appspotmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarDu Cheng <ducheng2@gmail.com>
      Link: https://lore.kernel.org/r/20210312081421.452405-1-ducheng2@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1e353852
    • Atul Gopinathan's avatar
      staging: rtl8192e: Change state information from u16 to u8 · 2bcc14fc
      Atul Gopinathan authored
      commit e78836ae upstream.
      
      The "u16 CcxRmState[2];" array field in struct "rtllib_network" has 4
      bytes in total while the operations performed on this array through-out
      the code base are only 2 bytes.
      
      The "CcxRmState" field is fed only 2 bytes of data using memcpy():
      
      (In rtllib_rx.c:1972)
      	memcpy(network->CcxRmState, &info_element->data[4], 2)
      
      With "info_element->data[]" being a u8 array, if 2 bytes are written
      into "CcxRmState" (whose one element is u16 size), then the 2 u8
      elements from "data[]" gets squashed and written into the first element
      ("CcxRmState[0]") while the second element ("CcxRmState[1]") is never
      fed with any data.
      
      Same in file rtllib_rx.c:2522:
      	 memcpy(dst->CcxRmState, src->CcxRmState, 2);
      
      The above line duplicates "src" data to "dst" but only writes 2 bytes
      (and not 4, which is the actual size). Again, only 1st element gets the
      value while the 2nd element remains uninitialized.
      
      This later makes operations done with CcxRmState unpredictable in the
      following lines as the 1st element is having a squashed number while the
      2nd element is having an uninitialized random number.
      
      rtllib_rx.c:1973:    if (network->CcxRmState[0] != 0)
      rtllib_rx.c:1977:    network->MBssidMask = network->CcxRmState[1] & 0x07;
      
      network->MBssidMask is also of type u8 and not u16.
      
      Fix this by changing the type of "CcxRmState" from u16 to u8 so that the
      data written into this array and read from it make sense and are not
      random values.
      
      NOTE: The wrong initialization of "CcxRmState" can be seen in the
      following commit:
      
      commit ecdfa446 ("Staging: add Realtek 8192 PCI wireless driver")
      
      The above commit created a file `rtl8192e/ieee80211.h` which used to
      have the faulty line. The file has been deleted (or possibly renamed)
      with the contents copied in to a new file `rtl8192e/rtllib.h` along with
      additional code in the commit 94a79942 (tagged in Fixes).
      
      Fixes: 94a79942
      
       ("From: wlanfae <wlanfae@realtek.com> [PATCH 1/8] rtl8192e: Import new version of driver from realtek")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAtul Gopinathan <atulgopinathan@gmail.com>
      Link: https://lore.kernel.org/r/20210323113413.29179-2-atulgopinathan@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2bcc14fc
    • Atul Gopinathan's avatar
      staging: rtl8192e: Fix incorrect source in memcpy() · 69811446
      Atul Gopinathan authored
      commit 72ad25fb upstream.
      
      The variable "info_element" is of the following type:
      
      	struct rtllib_info_element *info_element
      
      defined in drivers/staging/rtl8192e/rtllib.h:
      
      	struct rtllib_info_element {
      		u8 id;
      		u8 len;
      		u8 data[];
      	} __packed;
      
      The "len" field defines the size of the "data[]" array. The code is
      supposed to check if "info_element->len" is greater than 4 and later
      equal to 6. If this is satisfied then, the last two bytes (the 4th and
      5th element of u8 "data[]" array) are copied into "network->CcxRmState".
      
      Right now the code uses "memcpy()" with the source as "&info_element[4]"
      which would copy in wrong and unintended information. The struct
      "rtllib_info_element" has a size of 2 bytes for "id" and "len",
      therefore indexing will be done in interval of 2 bytes. So,
      "info_element[4]" would point to data which is beyond the memory
      allocated for this pointer (that is, at x+8, while "info_element" has
      been allocated only from x to x+7 (2 + 6 => 8 bytes)).
      
      This patch rectifies this error by using "&info_element->data[4]" which
      correctly copies the last two bytes of "data[]".
      
      NOTE: The faulty line of code came from the following commit:
      
      commit ecdfa446 ("Staging: add Realtek 8192 PCI wireless driver")
      
      The above commit created the file `rtl8192e/ieee80211/ieee80211_rx.c`
      which had the faulty line of code. This file has been deleted (or
      possibly renamed) with the contents copied in to a new file
      `rtl8192e/rtllib_rx.c` along with additional code in the commit
      94a79942 (tagged in Fixes).
      
      Fixes: 94a79942
      
       ("From: wlanfae <wlanfae@realtek.com> [PATCH 1/8] rtl8192e: Import new version of driver from realtek")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAtul Gopinathan <atulgopinathan@gmail.com>
      Link: https://lore.kernel.org/r/20210323113413.29179-1-atulgopinathan@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      69811446
    • Tong Zhang's avatar
      usb: gadget: udc: amd5536udc_pci fix null-ptr-dereference · 6b4aa865
      Tong Zhang authored
      commit 72035f49 upstream.
      
      init_dma_pools() calls dma_pool_create(...dev->dev) to create dma pool.
      however, dev->dev is actually set after calling init_dma_pools(), which
      effectively makes dma_pool_create(..NULL) and cause crash.
      To fix this issue, init dma only after dev->dev is set.
      
      [    1.317993] RIP: 0010:dma_pool_create+0x83/0x290
      [    1.323257] Call Trace:
      [    1.323390]  ? pci_write_config_word+0x27/0x30
      [    1.323626]  init_dma_pools+0x41/0x1a0 [snps_udc_core]
      [    1.323899]  udc_pci_probe+0x202/0x2b1 [amd5536udc_pci]
      
      Fixes: 7c51247a
      
       (usb: gadget: udc: Provide correct arguments for 'dma_pool_create')
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarTong Zhang <ztong0001@gmail.com>
      Link: https://lore.kernel.org/r/20210317230400.357756-1-ztong0001@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6b4aa865
    • Johan Hovold's avatar
      USB: cdc-acm: fix use-after-free after probe failure · a110a1d0
      Johan Hovold authored
      commit 4e49bf37 upstream.
      
      If tty-device registration fails the driver would fail to release the
      data interface. When the device is later disconnected, the disconnect
      callback would still be called for the data interface and would go about
      releasing already freed resources.
      
      Fixes: c93d8195
      
       ("usb: cdc-acm: fix error handling in acm_probe()")
      Cc: stable@vger.kernel.org      # 3.9
      Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
      Acked-by: default avatarOliver Neukum <oneukum@suse.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Link: https://lore.kernel.org/r/20210322155318.9837-3-johan@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a110a1d0
    • Oliver Neukum's avatar
      USB: cdc-acm: downgrade message to debug · 88fc6e1a
      Oliver Neukum authored
      commit e4c77070
      
       upstream.
      
      This failure is so common that logging an error here amounts
      to spamming log files.
      
      Reviewed-by: default avatarBruno Thomsen <bruno.thomsen@gmail.com>
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210311130126.15972-2-oneukum@suse.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      88fc6e1a
    • Oliver Neukum's avatar
      USB: cdc-acm: untangle a circular dependency between callback and softint · 0ea16074
      Oliver Neukum authored
      commit 6069e3e9
      
       upstream.
      
      We have a cycle of callbacks scheduling works which submit
      URBs with thos callbacks. This needs to be blocked, stopped
      and unblocked to untangle the circle.
      
      The issue leads to faults like:
      
      [   55.068392] Unable to handle kernel paging request at virtual address 6b6b6c03
      [   55.075624] pgd = be866494
      [   55.078335] [6b6b6c03] *pgd=00000000
      [   55.081924] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
      [   55.087238] Modules linked in: ppp_async crc_ccitt ppp_generic slhc
      xt_TCPMSS xt_tcpmss xt_hl nf_log_ipv6 nf_log_ipv4 nf_log_common
      xt_policy xt_limit xt_conntrack xt_tcpudp xt_pkttype ip6table_mangle
      iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4
      iptable_mangle ip6table_filter ip6_tables iptable_filter ip_tables
      des_generic md5 sch_fq_codel cdc_mbim cdc_wdm cdc_ncm usbnet mii
      cdc_acm usb_storage ip_tunnel xfrm_user xfrm6_tunnel tunnel6
      xfrm4_tunnel tunnel4 esp6 esp4 ah6 ah4 xfrm_algo xt_LOG xt_LED
      xt_comment x_tables ipv6
      [   55.134954] CPU: 0 PID: 82 Comm: kworker/0:2 Tainted: G
         T 5.8.17 #1
      [   55.142526] Hardware name: Freescale i.MX7 Dual (Device Tree)
      [   55.148304] Workqueue: events acm_softint [cdc_acm]
      [   55.153196] PC is at kobject_get+0x10/0xa4
      [   55.157302] LR is at usb_get_dev+0x14/0x1c
      [   55.161402] pc : [<8047c06c>]    lr : [<80560448>]    psr: 20000193
      [   55.167671] sp : bca39ea8  ip : 00007374  fp : bf6cbd80
      [   55.172899] r10: 00000000  r9 : bdd92284  r8 : bdd92008
      [   55.178128] r7 : 6b6b6b6b  r6 : fffffffe  r5 : 60000113  r4 : 6b6b6be3
      [   55.184658] r3 : 6b6b6b6b  r2 : 00000111  r1 : 00000000  r0 : 6b6b6be3
      [   55.191191] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM Segment none
      [   55.198417] Control: 10c5387d  Table: bcf0c06a  DAC: 00000051
      [   55.204168] Process kworker/0:2 (pid: 82, stack limit = 0x9bdd2a89)
      [   55.210439] Stack: (0xbca39ea8 to 0xbca3a000)
      [   55.214805] 9ea0:                   bf6cbd80 80769a50 6b6b6b6b 80560448 bdeb0500 8056bfe8
      [   55.222991] 9ec0: 00000002 b76da000 00000000 bdeb0500 bdd92448 bca38000 bdeb0510 8056d69c
      [   55.231177] 9ee0: bca38000 00000000 80c050fc 00000000 bca39f44 09d42015 00000000 00000001
      [   55.239363] 9f00: bdd92448 bdd92438 bdd92000 7f1158c4 bdd92448 bca2ee00 bf6cbd80 bf6cef00
      [   55.247549] 9f20: 00000000 00000000 00000000 801412d8 bf6cbd98 80c03d00 bca2ee00 bf6cbd80
      [   55.255735] 9f40: bca2ee14 bf6cbd98 80c03d00 00000008 bca38000 80141568 00000000 80c446ae
      [   55.263921] 9f60: 00000000 bc9ed880 bc9f0700 bca38000 bc117eb4 80141524 bca2ee00 bc9ed8a4
      [   55.272107] 9f80: 00000000 80147cc8 00000000 bc9f0700 80147b84 00000000 00000000 00000000
      [   55.280292] 9fa0: 00000000 00000000 00000000 80100148 00000000 00000000 00000000 00000000
      [   55.288477] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [   55.296662] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
      [   55.304860] [<8047c06c>] (kobject_get) from [<80560448>] (usb_get_dev+0x14/0x1c)
      [   55.312271] [<80560448>] (usb_get_dev) from [<8056bfe8>] (usb_hcd_unlink_urb+0x50/0xd8)
      [   55.320286] [<8056bfe8>] (usb_hcd_unlink_urb) from [<8056d69c>] (usb_kill_urb.part.0+0x44/0xd0)
      [   55.329004] [<8056d69c>] (usb_kill_urb.part.0) from [<7f1158c4>] (acm_softint+0x4c/0x10c [cdc_acm])
      [   55.338082] [<7f1158c4>] (acm_softint [cdc_acm]) from [<801412d8>] (process_one_work+0x19c/0x3e8)
      [   55.346969] [<801412d8>] (process_one_work) from [<80141568>] (worker_thread+0x44/0x4dc)
      [   55.355072] [<80141568>] (worker_thread) from [<80147cc8>] (kthread+0x144/0x180)
      [   55.362481] [<80147cc8>] (kthread) from [<80100148>] (ret_from_fork+0x14/0x2c)
      [   55.369706] Exception stack(0xbca39fb0 to 0xbca39ff8)
      
      Tested-by: default avatarBruno Thomsen <bruno.thomsen@gmail.com>
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210311130126.15972-1-oneukum@suse.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0ea16074
    • Oliver Neukum's avatar
      cdc-acm: fix BREAK rx code path adding necessary calls · 5b00c605
      Oliver Neukum authored
      commit 08dff274 upstream.
      
      Counting break events is nice but we should actually report them to
      the tty layer.
      
      Fixes: 5a6a62bd
      
       ("cdc-acm: add TIOCMIWAIT")
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Link: https://lore.kernel.org/r/20210311133714.31881-1-oneukum@suse.com
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5b00c605
    • Chunfeng Yun's avatar
      usb: xhci-mtk: fix broken streams issue on 0.96 xHCI · 7d8a4016
      Chunfeng Yun authored
      commit 6f978a30 upstream.
      
      The MediaTek 0.96 xHCI controller on some platforms does not
      support bulk stream even HCCPARAMS says supporting, due to MaxPSASize
      is set a default value 1 by mistake, here use XHCI_BROKEN_STREAMS
      quirk to fix it.
      
      Fixes: 94a631d9
      
       ("usb: xhci-mtk: check hcc_params after adding primary hcd")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarChunfeng Yun <chunfeng.yun@mediatek.com>
      Link: https://lore.kernel.org/r/1616482975-17841-4-git-send-email-chunfeng.yun@mediatek.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7d8a4016
    • Tony Lindgren's avatar
      usb: musb: Fix suspend with devices connected for a64 · 5dc2a68b
      Tony Lindgren authored
      commit 92af4fc6 upstream.
      
      Pinephone running on Allwinner A64 fails to suspend with USB devices
      connected as reported by Bhushan Shah <bshah@kde.org>. Reverting
      commit 5fbf7a25 ("usb: musb: fix idling for suspend after
      disconnect interrupt") fixes the issue.
      
      Let's add suspend checks also for suspend after disconnect interrupt
      quirk handling like we already do elsewhere.
      
      Fixes: 5fbf7a25
      
       ("usb: musb: fix idling for suspend after disconnect interrupt")
      Reported-by: default avatarBhushan Shah <bshah@kde.org>
      Tested-by: default avatarBhushan Shah <bshah@kde.org>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Link: https://lore.kernel.org/r/20210324071142.42264-1-tony@atomide.com
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5dc2a68b