Skip to content
  1. Oct 06, 2021
    • Igor Matheus Andrade Torrente's avatar
      tty: Fix out-of-bound vmalloc access in imageblit · 067c694d
      Igor Matheus Andrade Torrente authored
      [ Upstream commit 3b0c4061
      
       ]
      
      This issue happens when a userspace program does an ioctl
      FBIOPUT_VSCREENINFO passing the fb_var_screeninfo struct
      containing only the fields xres, yres, and bits_per_pixel
      with values.
      
      If this struct is the same as the previous ioctl, the
      vc_resize() detects it and doesn't call the resize_screen(),
      leaving the fb_var_screeninfo incomplete. And this leads to
      the updatescrollmode() calculates a wrong value to
      fbcon_display->vrows, which makes the real_y() return a
      wrong value of y, and that value, eventually, causes
      the imageblit to access an out-of-bound address value.
      
      To solve this issue I made the resize_screen() be called
      even if the screen does not need any resizing, so it will
      "fix and fill" the fb_var_screeninfo independently.
      
      Cc: stable <stable@vger.kernel.org> # after 5.15-rc2 is out, give it time to bake
      Reported-and-tested-by: default avatar <syzbot+858dc7a2f7ef07c2c219@syzkaller.appspotmail.com>
      Signed-off-by: default avatarIgor Matheus Andrade Torrente <igormtorrente@gmail.com>
      Link: https://lore.kernel.org/r/20210628134509.15895-1-igormtorrente@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      067c694d
    • Linus Torvalds's avatar
      qnx4: work around gcc false positive warning bug · 40faa4d1
      Linus Torvalds authored
      commit d5f65459 upstream.
      
      In commit b7213ffa
      
       ("qnx4: avoid stringop-overread errors") I tried
      to teach gcc about how the directory entry structure can be two
      different things depending on a status flag.  It made the code clearer,
      and it seemed to make gcc happy.
      
      However, Arnd points to a gcc bug, where despite using two different
      members of a union, gcc then gets confused, and uses the size of one of
      the members to decide if a string overrun happens.  And not necessarily
      the rigth one.
      
      End result: with some configurations, gcc-11 will still complain about
      the source buffer size being overread:
      
        fs/qnx4/dir.c: In function 'qnx4_readdir':
        fs/qnx4/dir.c:76:32: error: 'strnlen' specified bound [16, 48] exceeds source size 1 [-Werror=stringop-overread]
           76 |                         size = strnlen(name, size);
              |                                ^~~~~~~~~~~~~~~~~~~
        fs/qnx4/dir.c:26:22: note: source object declared here
           26 |                 char de_name;
              |                      ^~~~~~~
      
      because gcc will get confused about which union member entry is actually
      getting accessed, even when the source code is very clear about it.  Gcc
      internally will have combined two "redundant" pointers (pointing to
      different union elements that are at the same offset), and takes the
      size checking from one or the other - not necessarily the right one.
      
      This is clearly a gcc bug, but we can work around it fairly easily.  The
      biggest thing here is the big honking comment about why we do what we
      do.
      
      Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c6
      Reported-and-tested-by: default avatarArnd Bergmann <arnd@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      40faa4d1
    • Juergen Gross's avatar
      xen/balloon: fix balloon kthread freezing · ab9755f7
      Juergen Gross authored
      commit 96f5bd03 upstream.
      
      Commit 8480ed9c ("xen/balloon: use a kernel thread instead a
      workqueue") switched the Xen balloon driver to use a kernel thread.
      Unfortunately the patch omitted to call try_to_freeze() or to use
      wait_event_freezable_timeout(), causing a system suspend to fail.
      
      Fixes: 8480ed9c
      
       ("xen/balloon: use a kernel thread instead a workqueue")
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Link: https://lore.kernel.org/r/20210920100345.21939-1-jgross@suse.com
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ab9755f7
    • Evan Wang's avatar
      PCI: aardvark: Fix checking for PIO status · e21c6587
      Evan Wang authored
      commit fcb461e2
      
       upstream.
      
      There is an issue that when PCIe switch is connected to an Armada 3700
      board, there will be lots of warnings about PIO errors when reading the
      config space. According to Aardvark PIO read and write sequence in HW
      specification, the current way to check PIO status has the following
      issues:
      
      1) For PIO read operation, it reports the error message, which should be
         avoided according to HW specification.
      
      2) For PIO read and write operations, it only checks PIO operation complete
         status, which is not enough, and error status should also be checked.
      
      This patch aligns the code with Aardvark PIO read and write sequence in HW
      specification on PIO status check and fix the warnings when reading config
      space.
      
      [pali: Fix CRS handling when CRSSVE is not enabled]
      
      Link: https://lore.kernel.org/r/20210722144041.12661-2-pali@kernel.org
      Tested-by: default avatarVictor Gu <xigu@marvell.com>
      Signed-off-by: default avatarEvan Wang <xswang@marvell.com>
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: default avatarVictor Gu <xigu@marvell.com>
      Reviewed-by: default avatarMarek Behún <kabel@kernel.org>
      Cc: stable@vger.kernel.org # b1bd5714
      
       ("PCI: aardvark: Indicate error in 'val' when config read fails")
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e21c6587
    • Pali Rohár's avatar
      PCI: aardvark: Fix checking for PIO Non-posted Request · 538d73db
      Pali Rohár authored
      commit 8ceeac30
      
       upstream.
      
      PIO_NON_POSTED_REQ for PIO_STAT register is incorrectly defined. Bit 10 in
      register PIO_STAT indicates the response is to a non-posted request.
      
      Link: https://lore.kernel.org/r/20210624213345.3617-2-pali@kernel.org
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: default avatarMarek Behún <kabel@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      538d73db
    • Pali Rohár's avatar
      arm64: dts: marvell: armada-37xx: Extend PCIe MEM space · 59a446e2
      Pali Rohár authored
      commit 514ef1e6
      
       upstream.
      
      Current PCIe MEM space of size 16 MB is not enough for some combination
      of PCIe cards (e.g. NVMe disk together with ath11k wifi card). ARM Trusted
      Firmware for Armada 3700 platform already assigns 128 MB for PCIe window,
      so extend PCIe MEM space to the end of 128 MB PCIe window which allows to
      allocate more PCIe BARs for more PCIe cards.
      
      Without this change some combination of PCIe cards cannot be used and
      kernel show error messages in dmesg during initialization:
      
          pci 0000:00:00.0: BAR 8: no space for [mem size 0x01800000]
          pci 0000:00:00.0: BAR 8: failed to assign [mem size 0x01800000]
          pci 0000:00:00.0: BAR 6: assigned [mem 0xe8000000-0xe80007ff pref]
          pci 0000:01:00.0: BAR 8: no space for [mem size 0x01800000]
          pci 0000:01:00.0: BAR 8: failed to assign [mem size 0x01800000]
          pci 0000:02:03.0: BAR 8: no space for [mem size 0x01000000]
          pci 0000:02:03.0: BAR 8: failed to assign [mem size 0x01000000]
          pci 0000:02:07.0: BAR 8: no space for [mem size 0x00100000]
          pci 0000:02:07.0: BAR 8: failed to assign [mem size 0x00100000]
          pci 0000:03:00.0: BAR 0: no space for [mem size 0x01000000 64bit]
          pci 0000:03:00.0: BAR 0: failed to assign [mem size 0x01000000 64bit]
      
      Due to bugs in U-Boot port for Turris Mox, the second range in Turris Mox
      kernel DTS file for PCIe must start at 16 MB offset. Otherwise U-Boot
      crashes during loading of kernel DTB file. This bug is present only in
      U-Boot code for Turris Mox and therefore other Armada 3700 devices are not
      affected by this bug. Bug is fixed in U-Boot version 2021.07.
      
      To not break booting new kernels on existing versions of U-Boot on Turris
      Mox, use first 16 MB range for IO and second range with rest of PCIe window
      for MEM.
      
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Fixes: 76f6386b
      
       ("arm64: dts: marvell: Add Aardvark PCIe support for Armada 3700")
      Signed-off-by: default avatarGregory CLEMENT <gregory.clement@bootlin.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      59a446e2
    • Linus Torvalds's avatar
      spi: Fix tegra20 build with CONFIG_PM=n · 89d9390e
      Linus Torvalds authored
      [ Upstream commit efafec27
      
       ]
      
      Without CONFIG_PM enabled, the SET_RUNTIME_PM_OPS() macro ends up being
      empty, and the only use of tegra_slink_runtime_{resume,suspend} goes
      away, resulting in
      
        drivers/spi/spi-tegra20-slink.c:1200:12: error: ‘tegra_slink_runtime_resume’ defined but not used [-Werror=unused-function]
         1200 | static int tegra_slink_runtime_resume(struct device *dev)
              |            ^~~~~~~~~~~~~~~~~~~~~~~~~~
        drivers/spi/spi-tegra20-slink.c:1188:12: error: ‘tegra_slink_runtime_suspend’ defined but not used [-Werror=unused-function]
         1188 | static int tegra_slink_runtime_suspend(struct device *dev)
              |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      mark the functions __maybe_unused to make the build happy.
      
      This hits the alpha allmodconfig build (and others).
      
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      89d9390e
    • Guenter Roeck's avatar
      net: 6pack: Fix tx timeout and slot time · f98836a0
      Guenter Roeck authored
      [ Upstream commit 3c0d2a46
      
       ]
      
      tx timeout and slot time are currently specified in units of HZ.  On
      Alpha, HZ is defined as 1024.  When building alpha:allmodconfig, this
      results in the following error message.
      
        drivers/net/hamradio/6pack.c: In function 'sixpack_open':
        drivers/net/hamradio/6pack.c:71:41: error:
        	unsigned conversion from 'int' to 'unsigned char'
        	changes value from '256' to '0'
      
      In the 6PACK protocol, tx timeout is specified in units of 10 ms and
      transmitted over the wire:
      
          https://www.linux-ax25.org/wiki/6PACK
      
      Defining a value dependent on HZ doesn't really make sense, and
      presumably comes from the (very historical) situation where HZ was
      originally 100.
      
      Note that the SIXP_SLOTTIME use explicitly is about 10ms granularity:
      
              mod_timer(&sp->tx_t, jiffies + ((when + 1) * HZ) / 100);
      
      and the SIXP_TXDELAY walue is sent as a byte over the wire.
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f98836a0
    • Guenter Roeck's avatar
      alpha: Declare virt_to_phys and virt_to_bus parameter as pointer to volatile · 2de807c0
      Guenter Roeck authored
      [ Upstream commit 35a3f4ef
      
       ]
      
      Some drivers pass a pointer to volatile data to virt_to_bus() and
      virt_to_phys(), and that works fine.  One exception is alpha.  This
      results in a number of compile errors such as
      
        drivers/net/wan/lmc/lmc_main.c: In function 'lmc_softreset':
        drivers/net/wan/lmc/lmc_main.c:1782:50: error:
      	passing argument 1 of 'virt_to_bus' discards 'volatile'
      	qualifier from pointer target type
      
        drivers/atm/ambassador.c: In function 'do_loader_command':
        drivers/atm/ambassador.c:1747:58: error:
      	passing argument 1 of 'virt_to_bus' discards 'volatile'
      	qualifier from pointer target type
      
      Declare the parameter of virt_to_phys and virt_to_bus as pointer to
      volatile to fix the problem.
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2de807c0
    • Dan Li's avatar
      arm64: Mark __stack_chk_guard as __ro_after_init · 0a52ba73
      Dan Li authored
      [ Upstream commit 9fcb2e93
      
       ]
      
      __stack_chk_guard is setup once while init stage and never changed
      after that.
      
      Although the modification of this variable at runtime will usually
      cause the kernel to crash (so does the attacker), it should be marked
      as __ro_after_init, and it should not affect performance if it is
      placed in the ro_after_init section.
      
      Signed-off-by: default avatarDan Li <ashimida@linux.alibaba.com>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Link: https://lore.kernel.org/r/1631612642-102881-1-git-send-email-ashimida@linux.alibaba.com
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0a52ba73
    • Helge Deller's avatar
      parisc: Use absolute_pointer() to define PAGE0 · 7596c2bd
      Helge Deller authored
      [ Upstream commit 90cc7bed
      
       ]
      
      Use absolute_pointer() wrapper for PAGE0 to avoid this compiler warning:
      
        arch/parisc/kernel/setup.c: In function 'start_parisc':
        error: '__builtin_memcmp_eq' specified bound 8 exceeds source size 0
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Co-Developed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7596c2bd
    • Linus Torvalds's avatar
      qnx4: avoid stringop-overread errors · 0abc7244
      Linus Torvalds authored
      [ Upstream commit b7213ffa
      
       ]
      
      The qnx4 directory entries are 64-byte blocks that have different
      contents depending on the a status byte that is in the last byte of the
      block.
      
      In particular, a directory entry can be either a "link info" entry with
      a 48-byte name and pointers to the real inode information, or an "inode
      entry" with a smaller 16-byte name and the full inode information.
      
      But the code was written to always just treat the directory name as if
      it was part of that "inode entry", and just extend the name to the
      longer case if the status byte said it was a link entry.
      
      That work just fine and gives the right results, but now that gcc is
      tracking data structure accesses much more, the code can trigger a
      compiler error about using up to 48 bytes (the long name) in a structure
      that only has that shorter name in it:
      
         fs/qnx4/dir.c: In function ‘qnx4_readdir’:
         fs/qnx4/dir.c:51:32: error: ‘strnlen’ specified bound 48 exceeds source size 16 [-Werror=stringop-overread]
            51 |                         size = strnlen(de->di_fname, size);
               |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         In file included from fs/qnx4/qnx4.h:3,
                          from fs/qnx4/dir.c:16:
         include/uapi/linux/qnx4_fs.h:45:25: note: source object declared here
            45 |         char            di_fname[QNX4_SHORT_NAME_MAX];
               |                         ^~~~~~~~
      
      which is because the source code doesn't really make this whole "one of
      two different types" explicit.
      
      Fix this by introducing a very explicit union of the two types, and
      basically explaining to the compiler what is really going on.
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0abc7244
    • Linus Torvalds's avatar
      sparc: avoid stringop-overread errors · 57c6e551
      Linus Torvalds authored
      [ Upstream commit fc7c028d
      
       ]
      
      The sparc mdesc code does pointer games with 'struct mdesc_hdr', but
      didn't describe to the compiler how that header is then followed by the
      data that the header describes.
      
      As a result, gcc is now unhappy since it does stricter pointer range
      tracking, and doesn't understand about how these things work.  This
      results in various errors like:
      
          arch/sparc/kernel/mdesc.c: In function ‘mdesc_node_by_name’:
          arch/sparc/kernel/mdesc.c:647:22: error: ‘strcmp’ reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
            647 |                 if (!strcmp(names + ep[ret].name_offset, name))
                |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      which are easily avoided by just describing 'struct mdesc_hdr' better,
      and making the node_block() helper function look into that unsized
      data[] that follows the header.
      
      This makes the sparc64 build happy again at least for my cross-compiler
      version (gcc version 11.2.1).
      
      Link: https://lore.kernel.org/lkml/CAHk-=wi4NW3NC0xWykkw=6LnjQD6D_rtRtxY9g8gQAJXtQMi8A@mail.gmail.com/
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      57c6e551
    • Guenter Roeck's avatar
      net: i825xx: Use absolute_pointer for memcpy from fixed memory location · d67202e1
      Guenter Roeck authored
      [ Upstream commit dff2d131
      
       ]
      
      gcc 11.x reports the following compiler warning/error.
      
        drivers/net/ethernet/i825xx/82596.c: In function 'i82596_probe':
        arch/m68k/include/asm/string.h:72:25: error:
      	'__builtin_memcpy' reading 6 bytes from a region of size 0 [-Werror=stringop-overread]
      
      Use absolute_pointer() to work around the problem.
      
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Reviewed-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d67202e1
    • Guenter Roeck's avatar
      compiler.h: Introduce absolute_pointer macro · 9e067d47
      Guenter Roeck authored
      [ Upstream commit f6b5f1a5
      
       ]
      
      absolute_pointer() disassociates a pointer from its originating symbol
      type and context. Use it to prevent compiler warnings/errors such as
      
        drivers/net/ethernet/i825xx/82596.c: In function 'i82596_probe':
        arch/m68k/include/asm/string.h:72:25: error:
      	'__builtin_memcpy' reading 6 bytes from a region of size 0 [-Werror=stringop-overread]
      
      Such warnings may be reported by gcc 11.x for string and memory
      operations on fixed addresses.
      
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Reviewed-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9e067d47
    • Juergen Gross's avatar
      xen/balloon: use a kernel thread instead a workqueue · c5d5a43d
      Juergen Gross authored
      [ Upstream commit 8480ed9c
      
       ]
      
      Today the Xen ballooning is done via delayed work in a workqueue. This
      might result in workqueue hangups being reported in case of large
      amounts of memory are being ballooned in one go (here 16GB):
      
      BUG: workqueue lockup - pool cpus=6 node=0 flags=0x0 nice=0 stuck for 64s!
      Showing busy workqueues and worker pools:
      workqueue events: flags=0x0
        pwq 12: cpus=6 node=0 flags=0x0 nice=0 active=2/256 refcnt=3
          in-flight: 229:balloon_process
          pending: cache_reap
      workqueue events_freezable_power_: flags=0x84
        pwq 12: cpus=6 node=0 flags=0x0 nice=0 active=1/256 refcnt=2
          pending: disk_events_workfn
      workqueue mm_percpu_wq: flags=0x8
        pwq 12: cpus=6 node=0 flags=0x0 nice=0 active=1/256 refcnt=2
          pending: vmstat_update
      pool 12: cpus=6 node=0 flags=0x0 nice=0 hung=64s workers=3 idle: 2222 43
      
      This can easily be avoided by using a dedicated kernel thread for doing
      the ballooning work.
      
      Reported-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Link: https://lore.kernel.org/r/20210827123206.15429-1-jgross@suse.com
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c5d5a43d
    • Guenter Roeck's avatar
      m68k: Double cast io functions to unsigned long · e8bbc24f
      Guenter Roeck authored
      [ Upstream commit b1a89856
      
       ]
      
      m68k builds fail widely with errors such as
      
      arch/m68k/include/asm/raw_io.h:20:19: error:
      	cast to pointer from integer of different size
      arch/m68k/include/asm/raw_io.h:30:32: error:
      	cast to pointer from integer of different size [-Werror=int-to-p
      
      On m68k, io functions are defined as macros. The problem is seen if the
      macro parameter variable size differs from the size of a pointer. Cast
      the parameter of all io macros to unsigned long before casting it to
      a pointer to fix the problem.
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Link: https://lore.kernel.org/r/20210907060729.2391992-1-linux@roeck-us.net
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e8bbc24f
    • Jesper Nilsson's avatar
      net: stmmac: allow CSR clock of 300MHz · 3cd5d054
      Jesper Nilsson authored
      [ Upstream commit 08dad2f4
      
       ]
      
      The Synopsys Ethernet IP uses the CSR clock as a base clock for MDC.
      The divisor used is set in the MAC_MDIO_Address register field CR
      (Clock Rate)
      
      The divisor is there to change the CSR clock into a clock that falls
      below the IEEE 802.3 specified max frequency of 2.5MHz.
      
      If the CSR clock is 300MHz, the code falls back to using the reset
      value in the MAC_MDIO_Address register, as described in the comment
      above this code.
      
      However, 300MHz is actually an allowed value and the proper divider
      can be estimated quite easily (it's just 1Hz difference!)
      
      A CSR frequency of 300MHz with the maximum clock rate value of 0x5
      (STMMAC_CSR_250_300M, a divisor of 124) gives somewhere around
      ~2.42MHz which is below the IEEE 802.3 specified maximum.
      
      For the ARTPEC-8 SoC, the CSR clock is this problematic 300MHz,
      and unfortunately, the reset-value of the MAC_MDIO_Address CR field
      is 0x0.
      
      This leads to a clock rate of zero and a divisor of 42, and gives an
      MDC frequency of ~7.14MHz.
      
      Allow CSR clock of 300MHz by making the comparison inclusive.
      
      Signed-off-by: default avatarJesper Nilsson <jesper.nilsson@axis.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3cd5d054
    • Tong Zhang's avatar
      net: macb: fix use after free on rmmod · a7d521cc
      Tong Zhang authored
      [ Upstream commit d82d5303
      
       ]
      
      plat_dev->dev->platform_data is released by platform_device_unregister(),
      use of pclk and hclk is a use-after-free. Since device unregister won't
      need a clk device we adjust the function call sequence to fix this issue.
      
      [   31.261225] BUG: KASAN: use-after-free in macb_remove+0x77/0xc6 [macb_pci]
      [   31.275563] Freed by task 306:
      [   30.276782]  platform_device_release+0x25/0x80
      
      Suggested-by: default avatarNicolas Ferre <Nicolas.Ferre@microchip.com>
      Signed-off-by: default avatarTong Zhang <ztong0001@gmail.com>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a7d521cc
    • Zhihao Cheng's avatar
      blktrace: Fix uaf in blk_trace access after removing by sysfs · d56171d9
      Zhihao Cheng authored
      [ Upstream commit 5afedf67 ]
      
      There is an use-after-free problem triggered by following process:
      
            P1(sda)				P2(sdb)
      			echo 0 > /sys/block/sdb/trace/enable
      			  blk_trace_remove_queue
      			    synchronize_rcu
      			    blk_trace_free
      			      relay_close
      rcu_read_lock
      __blk_add_trace
        trace_note_tsk
        (Iterate running_trace_list)
      			        relay_close_buf
      				  relay_destroy_buf
      				    kfree(buf)
          trace_note(sdb's bt)
            relay_reserve
              buf->offset <- nullptr deference (use-after-free) !!!
      rcu_read_unlock
      
      [  502.714379] BUG: kernel NULL pointer dereference, address:
      0000000000000010
      [  502.715260] #PF: supervisor read access in kernel mode
      [  502.715903] #PF: error_code(0x0000) - not-present page
      [  502.716546] PGD 103984067 P4D 103984067 PUD 17592b067 PMD 0
      [  502.717252] Oops: 0000 [#1] SMP
      [  502.720308] RIP: 0010:trace_note.isra.0+0x86/0x360
      [  502.732872] Call Trace:
      [  502.733193]  __blk_add_trace.cold+0x137/0x1a3
      [  502.733734]  blk_add_trace_rq+0x7b/0xd0
      [  502.734207]  blk_add_trace_rq_issue+0x54/0xa0
      [  502.734755]  blk_mq_start_request+0xde/0x1b0
      [  502.735287]  scsi_queue_rq+0x528/0x1140
      ...
      [  502.742704]  sg_new_write.isra.0+0x16e/0x3e0
      [  502.747501]  sg_ioctl+0x466/0x1100
      
      Reproduce method:
        ioctl(/dev/sda, BLKTRACESETUP, blk_user_trace_setup[buf_size=127])
        ioctl(/dev/sda, BLKTRACESTART)
        ioctl(/dev/sdb, BLKTRACESETUP, blk_user_trace_setup[buf_size=127])
        ioctl(/dev/sdb, BLKTRACESTART)
      
        echo 0 > /sys/block/sdb/trace/enable &
        // Add delay(mdelay/msleep) before kernel enters blk_trace_free()
      
        ioctl$SG_IO(/dev/sda, SG_IO, ...)
        // Enters trace_note_tsk() after blk_trace_free() returned
        // Use mdelay in rcu region rather than msleep(which may schedule out)
      
      Remove blk_trace from running_list before calling blk_trace_free() by
      sysfs if blk_trace is at Blktrace_running state.
      
      Fixes: c71a8961
      
       ("blktrace: add ftrace plugin")
      Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Link: https://lore.kernel.org/r/20210923134921.109194-1-chengzhihao1@huawei.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d56171d9
    • Christoph Hellwig's avatar
      md: fix a lock order reversal in md_alloc · 9252a5f3
      Christoph Hellwig authored
      [ Upstream commit 7df835a3 ]
      
      Commit b0140891 ("md: Fix race when creating a new md device.")
      not only moved assigning mddev->gendisk before calling add_disk, which
      fixes the races described in the commit log, but also added a
      mddev->open_mutex critical section over add_disk and creation of the
      md kobj.  Adding a kobject after add_disk is racy vs deleting the gendisk
      right after adding it, but md already prevents against that by holding
      a mddev->active reference.
      
      On the other hand taking this lock added a lock order reversal with what
      is not disk->open_mutex (used to be bdev->bd_mutex when the commit was
      added) for partition devices, which need that lock for the internal open
      for the partition scan, and a recent commit also takes it for
      non-partitioned devices, leading to further lockdep splatter.
      
      Fixes: b0140891 ("md: Fix race when creating a new md device.")
      Fixes: d6263387
      
       ("block: support delayed holder registration")
      Reported-by: default avatar <syzbot+fadc0aaf497e6a493b9f@syzkaller.appspotmail.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Tested-by: default avatar <syzbot+fadc0aaf497e6a493b9f@syzkaller.appspotmail.com>
      Reviewed-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9252a5f3
    • Kaige Fu's avatar
      irqchip/gic-v3-its: Fix potential VPE leak on error · 7d39992d
      Kaige Fu authored
      [ Upstream commit 280bef51 ]
      
      In its_vpe_irq_domain_alloc, when its_vpe_init() returns an error,
      there is an off-by-one in the number of VPEs to be freed.
      
      Fix it by simply passing the number of VPEs allocated, which is the
      index of the loop iterating over the VPEs.
      
      Fixes: 7d75bbb4
      
       ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown")
      Signed-off-by: default avatarKaige Fu <kaige.fu@linux.alibaba.com>
      [maz: fixed commit message]
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/d9e36dee512e63670287ed9eff884a5d8d6d27f2.1631672311.git.kaige.fu@linux.alibaba.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7d39992d
    • Dan Carpenter's avatar
      thermal/core: Potential buffer overflow in thermal_build_list_of_policies() · 31710aed
      Dan Carpenter authored
      [ Upstream commit 1bb30b20 ]
      
      After printing the list of thermal governors, then this function prints
      a newline character.  The problem is that "size" has not been updated
      after printing the last governor.  This means that it can write one
      character (the NUL terminator) beyond the end of the buffer.
      
      Get rid of the "size" variable and just use "PAGE_SIZE - count" directly.
      
      Fixes: 1b4f4849
      
       ("thermal: core: group functions related to governor handling")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Link: https://lore.kernel.org/r/20210916131342.GB25094@kili
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      31710aed
    • Baokun Li's avatar
      scsi: iscsi: Adjust iface sysfs attr detection · b4599172
      Baokun Li authored
      [ Upstream commit 4e285508 ]
      
      ISCSI_NET_PARAM_IFACE_ENABLE belongs to enum iscsi_net_param instead of
      iscsi_iface_param so move it to ISCSI_NET_PARAM. Otherwise, when we call
      into the driver, we might not match and return that we don't want attr
      visible in sysfs. Found in code review.
      
      Link: https://lore.kernel.org/r/20210901085336.2264295-1-libaokun1@huawei.com
      Fixes: e746f345
      
       ("scsi: iscsi: Fix iface sysfs attr detection")
      Reviewed-by: default avatarLee Duncan <lduncan@suse.com>
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b4599172
    • Aya Levin's avatar
      net/mlx4_en: Don't allow aRFS for encapsulated packets · 5dbb8234
      Aya Levin authored
      [ Upstream commit fdbccea4 ]
      
      Driver doesn't support aRFS for encapsulated packets, return early error
      in such a case.
      
      Fixes: 1eb8c695
      
       ("net/mlx4_en: Add accelerated RFS support")
      Signed-off-by: default avatarAya Levin <ayal@nvidia.com>
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5dbb8234
    • Michael Chan's avatar
      bnxt_en: Fix TX timeout when TX ring size is set to the smallest · 0c8ff255
      Michael Chan authored
      [ Upstream commit 5bed8b07 ]
      
      The smallest TX ring size we support must fit a TX SKB with MAX_SKB_FRAGS
      + 1.  Because the first TX BD for a packet is always a long TX BD, we
      need an extra TX BD to fit this packet.  Define BNXT_MIN_TX_DESC_CNT with
      this value to make this more clear.  The current code uses a minimum
      that is off by 1.  Fix it using this constant.
      
      The tx_wake_thresh to determine when to wake up the TX queue is half the
      ring size but we must have at least BNXT_MIN_TX_DESC_CNT for the next
      packet which may have maximum fragments.  So the comparison of the
      available TX BDs with tx_wake_thresh should be >= instead of > in the
      current code.  Otherwise, at the smallest ring size, we will never wake
      up the TX queue and will cause TX timeout.
      
      Fixes: c0c050c5
      
       ("bnxt_en: New Broadcom ethernet driver.")
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadocm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0c8ff255
    • Johan Hovold's avatar
      net: hso: fix muxed tty registration · 3bfcd025
      Johan Hovold authored
      commit e8f69b16 upstream.
      
      If resource allocation and registration fail for a muxed tty device
      (e.g. if there are no more minor numbers) the driver should not try to
      deregister the never-registered (or already-deregistered) tty.
      
      Fix up the error handling to avoid dereferencing a NULL pointer when
      attempting to remove the character device.
      
      Fixes: 72dc1c09
      
       ("HSO: add option hso driver")
      Cc: stable@vger.kernel.org	# 2.6.27
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3bfcd025
    • Pali Rohár's avatar
      serial: mvebu-uart: fix driver's tx_empty callback · 503b2e01
      Pali Rohár authored
      commit 74e1eb3b upstream.
      
      Driver's tx_empty callback should signal when the transmit shift register
      is empty. So when the last character has been sent.
      
      STAT_TX_FIFO_EMP bit signals only that HW transmit FIFO is empty, which
      happens when the last byte is loaded into transmit shift register.
      
      STAT_TX_EMP bit signals when the both HW transmit FIFO and transmit shift
      register are empty.
      
      So replace STAT_TX_FIFO_EMP check by STAT_TX_EMP in mvebu_uart_tx_empty()
      callback function.
      
      Fixes: 30530791
      
       ("serial: mvebu-uart: initial support for Armada-3700 serial port")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Link: https://lore.kernel.org/r/20210911132017.25505-1-pali@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      503b2e01
    • Dan Carpenter's avatar
      mcb: fix error handling in mcb_alloc_bus() · 115b07d9
      Dan Carpenter authored
      commit 25a14332 upstream.
      
      There are two bugs:
      1) If ida_simple_get() fails then this code calls put_device(carrier)
         but we haven't yet called get_device(carrier) and probably that
         leads to a use after free.
      2) After device_initialize() then we need to use put_device() to
         release the bus.  This will free the internal resources tied to the
         device and call mcb_free_bus() which will free the rest.
      
      Fixes: 5d9e2ab9 ("mcb: Implement bus->dev.release callback")
      Fixes: 18d28819
      
       ("mcb: Correctly initialize the bus's device")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJohannes Thumshirn <jth@kernel.org>
      Link: https://lore.kernel.org/r/32e160cf6864ce77f9d62948338e24db9fd8ead9.1630931319.git.johannes.thumshirn@wdc.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      115b07d9
    • Slark Xiao's avatar
      USB: serial: option: add device id for Foxconn T99W265 · dcb8f64d
      Slark Xiao authored
      commit 9e3eed53
      
       upstream.
      
      Adding support for Foxconn device T99W265 for enumeration with
      PID 0xe0db.
      
      usb-devices output for 0xe0db
      T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 19 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
      P:  Vendor=0489 ProdID=e0db Rev=05.04
      S:  Manufacturer=Microsoft
      S:  Product=Generic Mobile Broadband Adapter
      S:  SerialNumber=6c50f452
      C:  #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=896mA
      I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      I:  If#=0x4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      
      if0/1: MBIM, if2:Diag, if3:GNSS, if4: Modem
      
      Signed-off-by: default avatarSlark Xiao <slark_xiao@163.com>
      Link: https://lore.kernel.org/r/20210917110106.9852-1-slark_xiao@163.com
      [ johan: use USB_DEVICE_INTERFACE_CLASS(), amend comment ]
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dcb8f64d
    • Krzysztof Kozlowski's avatar
      USB: serial: option: remove duplicate USB device ID · 10f36c0e
      Krzysztof Kozlowski authored
      commit 1ca200a8
      
       upstream.
      
      The device ZTE 0x0094 is already on the list.
      
      Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
      Fixes: b9e44fe5
      
       ("USB: option: cleanup zte 3g-dongle's pid in option.c")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      10f36c0e
    • Carlo Lobrano's avatar
      USB: serial: option: add Telit LN920 compositions · 92351dce
      Carlo Lobrano authored
      commit 7bb05713
      
       upstream.
      
      This patch adds the following Telit LN920 compositions:
      
      0x1060: tty, adb, rmnet, tty, tty, tty, tty
      0x1061: tty, adb, mbim, tty, tty, tty, tty
      0x1062: rndis, tty, adb, tty, tty, tty, tty
      0x1063: tty, adb, ecm, tty, tty, tty, tty
      
      Signed-off-by: default avatarCarlo Lobrano <c.lobrano@gmail.com>
      Link: https://lore.kernel.org/r/20210903123913.1086513-1-c.lobrano@gmail.com
      Reviewed-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      92351dce
    • Krzysztof Kozlowski's avatar
      USB: serial: mos7840: remove duplicated 0xac24 device ID · 6c2cfb71
      Krzysztof Kozlowski authored
      commit 211f3237 upstream.
      
      0xac24 device ID is already defined and used via
      BANDB_DEVICE_ID_USO9ML2_4.  Remove the duplicate from the list.
      
      Fixes: 27f1281d
      
       ("USB: serial: Extra device/vendor ID for mos7840 driver")
      Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6c2cfb71
    • Julian Sikorski's avatar
      Re-enable UAS for LaCie Rugged USB3-FW with fk quirk · c09bdd8d
      Julian Sikorski authored
      commit ce1c42b4
      
       upstream.
      
      Further testing has revealed that LaCie Rugged USB3-FW does work with
      uas as long as US_FL_NO_REPORT_OPCODES and US_FL_NO_SAME are enabled.
      
      Link: https://lore.kernel.org/linux-usb/2167ea48-e273-a336-a4e0-10a4e883e75e@redhat.com/
      Cc: stable <stable@vger.kernel.org>
      Suggested-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarOliver Neukum <oneukum@suse.com>
      Signed-off-by: default avatarJulian Sikorski <belegdol+github@gmail.com>
      Link: https://lore.kernel.org/r/20210913181454.7365-1-belegdol+github@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c09bdd8d
    • Johan Hovold's avatar
      staging: greybus: uart: fix tty use after free · 64062fca
      Johan Hovold authored
      commit 92dc0b1f upstream.
      
      User space can hold a tty open indefinitely and tty drivers must not
      release the underlying structures until the last user is gone.
      
      Switch to using the tty-port reference counter to manage the life time
      of the greybus tty state to avoid use after free after a disconnect.
      
      Fixes: a18e1517
      
       ("greybus: more uart work")
      Cc: stable@vger.kernel.org      # 4.9
      Reviewed-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Link: https://lore.kernel.org/r/20210906124538.22358-1-johan@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      64062fca
    • Uwe Brandt's avatar
      USB: serial: cp210x: add ID for GW Instek GDM-834x Digital Multimeter · 70981eab
      Uwe Brandt authored
      commit 3bd18ba7
      
       upstream.
      
      Add the USB serial device ID for the GW Instek GDM-834x Digital Multimeter.
      
      Signed-off-by: default avatarUwe Brandt <uwe.brandt@gmail.com>
      Link: https://lore.kernel.org/r/YUxFl3YUCPGJZd8Y@hovoldconsulting.com
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      70981eab
    • Ondrej Zary's avatar
      usb-storage: Add quirk for ScanLogic SL11R-IDE older than 2.6c · 6770d718
      Ondrej Zary authored
      commit b55d37ef
      
       upstream.
      
      ScanLogic SL11R-IDE with firmware older than 2.6c (the latest one) has
      broken tag handling, preventing the device from working at all:
      usb 1-1: new full-speed USB device number 2 using uhci_hcd
      usb 1-1: New USB device found, idVendor=04ce, idProduct=0002, bcdDevice= 2.60
      usb 1-1: New USB device strings: Mfr=1, Product=1, SerialNumber=0
      usb 1-1: Product: USB Device
      usb 1-1: Manufacturer: USB Device
      usb-storage 1-1:1.0: USB Mass Storage device detected
      scsi host2: usb-storage 1-1:1.0
      usbcore: registered new interface driver usb-storage
      usb 1-1: reset full-speed USB device number 2 using uhci_hcd
      usb 1-1: reset full-speed USB device number 2 using uhci_hcd
      usb 1-1: reset full-speed USB device number 2 using uhci_hcd
      usb 1-1: reset full-speed USB device number 2 using uhci_hcd
      
      Add US_FL_BULK_IGNORE_TAG to fix it. Also update my e-mail address.
      
      2.6c is the only firmware that claims Linux compatibility.
      The firmware can be upgraded using ezotgdbg utility:
      https://github.com/asciilifeform/ezotgdbg
      
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarOndrej Zary <linux@zary.sk>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210913210106.12717-1-linux@zary.sk
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6770d718
    • Jan Beulich's avatar
      xen/x86: fix PV trap handling on secondary processors · e316892e
      Jan Beulich authored
      commit 0594c581 upstream.
      
      The initial observation was that in PV mode under Xen 32-bit user space
      didn't work anymore. Attempts of system calls ended in #GP(0x402). All
      of the sudden the vector 0x80 handler was not in place anymore. As it
      turns out up to 5.13 redundant initialization did occur: Once from
      cpu_initialize_context() (through its VCPUOP_initialise hypercall) and a
      2nd time while each CPU was brought fully up. This 2nd initialization is
      now gone, uncovering that the 1st one was flawed: Unlike for the
      set_trap_table hypercall, a full virtual IDT needs to be specified here;
      the "vector" fields of the individual entries are of no interest. With
      many (kernel) IDT entries still(?) (i.e. at that point at least) empty,
      the syscall vector 0x80 ended up in slot 0x20 of the virtual IDT, thus
      becoming the domain's handler for vector 0x20.
      
      Make xen_convert_trap_info() fit for either purpose, leveraging the fact
      that on the xen_copy_trap_info() path the table starts out zero-filled.
      This includes moving out the writing of the sentinel, which would also
      have lead to a buffer overrun in the xen_copy_trap_info() case if all
      (kernel) IDT entries were populated. Convert the writing of the sentinel
      to clearing of the entire table entry rather than just the address
      field.
      
      (I didn't bother trying to identify the commit which uncovered the issue
      in 5.14; the commit named below is the one which actually introduced the
      bad code.)
      
      Fixes: f87e4cac
      
       ("xen: SMP guest support")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Link: https://lore.kernel.org/r/7a266932-092e-b68f-f2bb-1473b61adc6e@suse.com
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e316892e
    • Steve French's avatar
      cifs: fix incorrect check for null pointer in header_assemble · 26fe3ebf
      Steve French authored
      commit 9ed38fd4
      
       upstream.
      
      Although very unlikely that the tlink pointer would be null in this case,
      get_next_mid function can in theory return null (but not an error)
      so need to check for null (not for IS_ERR, which can not be returned
      here).
      
      Address warning:
      
              fs/smbfs_client/connect.c:2392 cifs_match_super()
              warn: 'tlink' isn't an ERR_PTR
      
      Pointed out by Dan Carpenter via smatch code analysis tool
      
      CC: stable@vger.kernel.org
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      26fe3ebf
    • Dan Carpenter's avatar
      usb: musb: tusb6010: uninitialized data in tusb_fifo_write_unaligned() · 5a2c093a
      Dan Carpenter authored
      commit 517c7bf9 upstream.
      
      This is writing to the first 1 - 3 bytes of "val" and then writing all
      four bytes to musb_writel().  The last byte is always going to be
      garbage.  Zero out the last bytes instead.
      
      Fixes: 550a7375
      
       ("USB: Add MUSB and TUSB support")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210916135737.GI25094@kili
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5a2c093a