Skip to content
  1. Mar 23, 2022
    • Christoph Niedermaier's avatar
      drm/imx: parallel-display: Remove bus flags check in imx_pd_bridge_atomic_check() · 9d45aec0
      Christoph Niedermaier authored
      [ Upstream commit 6061806a ]
      
      If display timings were read from the devicetree using
      of_get_display_timing() and pixelclk-active is defined
      there, the flag DISPLAY_FLAGS_SYNC_POSEDGE/NEGEDGE is
      automatically generated. Through the function
      drm_bus_flags_from_videomode() e.g. called in the
      panel-simple driver this flag got into the bus flags,
      but then in imx_pd_bridge_atomic_check() the bus flag
      check failed and will not initialize the display. The
      original commit fe141ced does not explain why this
      check was introduced. So remove the bus flags check,
      because it stops the initialization of the display with
      valid bus flags.
      
      Fixes: fe141ced
      
       ("drm/imx: pd: Use bus format/flags provided by the bridge when available")
      Signed-off-by: default avatarChristoph Niedermaier <cniedermaier@dh-electronics.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Boris Brezillon <boris.brezillon@collabora.com>
      Cc: Philipp Zabel <p.zabel@pengutronix.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: NXP Linux Team <linux-imx@nxp.com>
      Cc: linux-arm-kernel@lists.infradead.org
      To: dri-devel@lists.freedesktop.org
      Tested-by: default avatarMax Krummenacher <max.krummenacher@toradex.com>
      Acked-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220201113643.4638-1-cniedermaier@dh-electronics.com
      
      
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9d45aec0
    • 蒋家盛's avatar
      hv_netvsc: Add check for kvmalloc_array · 9b763ced
      蒋家盛 authored
      [ Upstream commit 886e44c9 ]
      
      As the potential failure of the kvmalloc_array(),
      it should be better to check and restore the 'data'
      if fails in order to avoid the dereference of the
      NULL pointer.
      
      Fixes: 6ae74671
      
       ("hv_netvsc: Add per-cpu ethtool stats for netvsc")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Link: https://lore.kernel.org/r/20220314020125.2365084-1-jiasheng@iscas.ac.cn
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9b763ced
    • 蒋家盛's avatar
      atm: eni: Add check for dma_map_single · 09a7264f
      蒋家盛 authored
      [ Upstream commit 0f74b29a ]
      
      As the potential failure of the dma_map_single(),
      it should be better to check it and return error
      if fails.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      09a7264f
    • Eric Dumazet's avatar
      net/packet: fix slab-out-of-bounds access in packet_recvmsg() · 70b7b3c0
      Eric Dumazet authored
      [ Upstream commit c700525f ]
      
      syzbot found that when an AF_PACKET socket is using PACKET_COPY_THRESH
      and mmap operations, tpacket_rcv() is queueing skbs with
      garbage in skb->cb[], triggering a too big copy [1]
      
      Presumably, users of af_packet using mmap() already gets correct
      metadata from the mapped buffer, we can simply make sure
      to clear 12 bytes that might be copied to user space later.
      
      BUG: KASAN: stack-out-of-bounds in memcpy include/linux/fortify-string.h:225 [inline]
      BUG: KASAN: stack-out-of-bounds in packet_recvmsg+0x56c/0x1150 net/packet/af_packet.c:3489
      Write of size 165 at addr ffffc9000385fb78 by task syz-executor233/3631
      
      CPU: 0 PID: 3631 Comm: syz-executor233 Not tainted 5.17.0-rc7-syzkaller-02396-g0b3660695e80 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
       print_address_description.constprop.0.cold+0xf/0x336 mm/kasan/report.c:255
       __kasan_report mm/kasan/report.c:442 [inline]
       kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
       check_region_inline mm/kasan/generic.c:183 [inline]
       kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189
       memcpy+0x39/0x60 mm/kasan/shadow.c:66
       memcpy include/linux/fortify-string.h:225 [inline]
       packet_recvmsg+0x56c/0x1150 net/packet/af_packet.c:3489
       sock_recvmsg_nosec net/socket.c:948 [inline]
       sock_recvmsg net/socket.c:966 [inline]
       sock_recvmsg net/socket.c:962 [inline]
       ____sys_recvmsg+0x2c4/0x600 net/socket.c:2632
       ___sys_recvmsg+0x127/0x200 net/socket.c:2674
       __sys_recvmsg+0xe2/0x1a0 net/socket.c:2704
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x7fdfd5954c29
      Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 15 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007ffcf8e71e48 EFLAGS: 00000246 ORIG_RAX: 000000000000002f
      RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fdfd5954c29
      RDX: 0000000000000000 RSI: 0000000020000500 RDI: 0000000000000005
      RBP: 0000000000000000 R08: 000000000000000d R09: 000000000000000d
      R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffcf8e71e60
      R13: 00000000000f4240 R14: 000000000000c1ff R15: 00007ffcf8e71e54
       </TASK>
      
      addr ffffc9000385fb78 is located in stack of task syz-executor233/3631 at offset 32 in frame:
       ____sys_recvmsg+0x0/0x600 include/linux/uio.h:246
      
      this frame has 1 object:
       [32, 160) 'addr'
      
      Memory state around the buggy address:
       ffffc9000385fa80: 00 04 f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00
       ffffc9000385fb00: 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00
      >ffffc9000385fb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f3
                                                                      ^
       ffffc9000385fc00: f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 f1
       ffffc9000385fc80: f1 f1 f1 00 f2 f2 f2 00 f2 f2 f2 00 00 00 00 00
      ==================================================================
      
      Fixes: 0fb375fb
      
       ("[AF_PACKET]: Allow for > 8 byte hardware addresses.")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Link: https://lore.kernel.org/r/20220312232958.3535620-1-eric.dumazet@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      70b7b3c0
    • Kurt Cancemi's avatar
      net: phy: marvell: Fix invalid comparison in the resume and suspend functions · 169add82
      Kurt Cancemi authored
      [ Upstream commit 837d9e49 ]
      
      This bug resulted in only the current mode being resumed and suspended when
      the PHY supported both fiber and copper modes and when the PHY only supported
      copper mode the fiber mode would incorrectly be attempted to be resumed and
      suspended.
      
      Fixes: 3758be3d
      
       ("Marvell phy: add functions to suspend and resume both interfaces: fiber and copper links.")
      Signed-off-by: default avatarKurt Cancemi <kurt@x64architecture.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20220312201512.326047-1-kurt@x64architecture.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      169add82
    • Sabrina Dubroca's avatar
      esp6: fix check on ipv6_skip_exthdr's return value · 01fac1ca
      Sabrina Dubroca authored
      [ Upstream commit 4db4075f ]
      
      Commit 5f9c55c8 ("ipv6: check return value of ipv6_skip_exthdr")
      introduced an incorrect check, which leads to all ESP packets over
      either TCPv6 or UDPv6 encapsulation being dropped. In this particular
      case, offset is negative, since skb->data points to the ESP header in
      the following chain of headers, while skb->network_header points to
      the IPv6 header:
      
          IPv6 | ext | ... | ext | UDP | ESP | ...
      
      That doesn't seem to be a problem, especially considering that if we
      reach esp6_input_done2, we're guaranteed to have a full set of headers
      available (otherwise the packet would have been dropped earlier in the
      stack). However, it means that the return value will (intentionally)
      be negative. We can make the test more specific, as the expected
      return value of ipv6_skip_exthdr will be the (negated) size of either
      a UDP header, or a TCP header with possible options.
      
      In the future, we should probably either make ipv6_skip_exthdr
      explicitly accept negative offsets (and adjust its return value for
      error cases), or make ipv6_skip_exthdr only take non-negative
      offsets (and audit all callers).
      
      Fixes: 5f9c55c8
      
       ("ipv6: check return value of ipv6_skip_exthdr")
      Reported-by: default avatarXiumei Mu <xmu@redhat.com>
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      01fac1ca
    • Jiyong Park's avatar
      vsock: each transport cycles only on its own sockets · d9fe5909
      Jiyong Park authored
      [ Upstream commit 8e6ed963 ]
      
      When iterating over sockets using vsock_for_each_connected_socket, make
      sure that a transport filters out sockets that don't belong to the
      transport.
      
      There actually was an issue caused by this; in a nested VM
      configuration, destroying the nested VM (which often involves the
      closing of /dev/vhost-vsock if there was h2g connections to the nested
      VM) kills not only the h2g connections, but also all existing g2h
      connections to the (outmost) host which are totally unrelated.
      
      Tested: Executed the following steps on Cuttlefish (Android running on a
      VM) [1]: (1) Enter into an `adb shell` session - to have a g2h
      connection inside the VM, (2) open and then close /dev/vhost-vsock by
      `exec 3< /dev/vhost-vsock && exec 3<&-`, (3) observe that the adb
      session is not reset.
      
      [1] https://android.googlesource.com/device/google/cuttlefish/
      
      Fixes: c0cfa2d8
      
       ("vsock: add multi-transports support")
      Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarJiyong Park <jiyong@google.com>
      Link: https://lore.kernel.org/r/20220311020017.1509316-1-jiyong@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d9fe5909
    • Randy Dunlap's avatar
      efi: fix return value of __setup handlers · ac7dd609
      Randy Dunlap authored
      [ Upstream commit 9feaf8b3 ]
      
      When "dump_apple_properties" is used on the kernel boot command line,
      it causes an Unknown parameter message and the string is added to init's
      argument strings:
      
        Unknown kernel command line parameters "dump_apple_properties
          BOOT_IMAGE=/boot/bzImage-517rc6 efivar_ssdt=newcpu_ssdt", will be
          passed to user space.
      
       Run /sbin/init as init process
         with arguments:
           /sbin/init
           dump_apple_properties
         with environment:
           HOME=/
           TERM=linux
           BOOT_IMAGE=/boot/bzImage-517rc6
           efivar_ssdt=newcpu_ssdt
      
      Similarly when "efivar_ssdt=somestring" is used, it is added to the
      Unknown parameter message and to init's environment strings, polluting
      them (see examples above).
      
      Change the return value of the __setup functions to 1 to indicate
      that the __setup options have been handled.
      
      Fixes: 58c5475a ("x86/efi: Retrieve and assign Apple device properties")
      Fixes: 475fb4e8
      
       ("efi / ACPI: load SSTDs from EFI variables")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Reported-by: default avatarIgor Zhbanov <i.zhbanov@omprussia.ru>
      Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
      Cc: Ard Biesheuvel <ardb@kernel.org>
      Cc: linux-efi@vger.kernel.org
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Octavian Purdila <octavian.purdila@intel.com>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Link: https://lore.kernel.org/r/20220301041851.12459-1-rdunlap@infradead.org
      
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ac7dd609
    • Guo Ziliang's avatar
      mm: swap: get rid of livelock in swapin readahead · fa3aa103
      Guo Ziliang authored
      commit 029c4628 upstream.
      
      In our testing, a livelock task was found.  Through sysrq printing, same
      stack was found every time, as follows:
      
        __swap_duplicate+0x58/0x1a0
        swapcache_prepare+0x24/0x30
        __read_swap_cache_async+0xac/0x220
        read_swap_cache_async+0x58/0xa0
        swapin_readahead+0x24c/0x628
        do_swap_page+0x374/0x8a0
        __handle_mm_fault+0x598/0xd60
        handle_mm_fault+0x114/0x200
        do_page_fault+0x148/0x4d0
        do_translation_fault+0xb0/0xd4
        do_mem_abort+0x50/0xb0
      
      The reason for the livelock is that swapcache_prepare() always returns
      EEXIST, indicating that SWAP_HAS_CACHE has not been cleared, so that it
      cannot jump out of the loop.  We suspect that the task that clears the
      SWAP_HAS_CACHE flag never gets a chance to run.  We try to lower the
      priority of the task stuck in a livelock so that the task that clears
      the SWAP_HAS_CACHE flag will run.  The results show that the system
      returns to normal after the priority is lowered.
      
      In our testing, multiple real-time tasks are bound to the same core, and
      the task in the livelock is the highest priority task of the core, so
      the livelocked task cannot be preempted.
      
      Although cond_resched() is used by __read_swap_cache_async, it is an
      empty function in the preemptive system and cannot achieve the purpose
      of releasing the CPU.  A high-priority task cannot release the CPU
      unless preempted by a higher-priority task.  But when this task is
      already the highest priority task on this core, other tasks will not be
      able to be scheduled.  So we think we should replace cond_resched() with
      schedule_timeout_uninterruptible(1), schedule_timeout_interruptible will
      call set_current_state first to set the task state, so the task will be
      removed from the running queue, so as to achieve the purpose of giving
      up the CPU and prevent it from running in kernel mode for too long.
      
      (akpm: ugly hack becomes uglier.  But it fixes the issue in a
      backportable-to-stable fashion while we hopefully work on something
      better)
      
      Link: https://lkml.kernel.org/r/20220221111749.1928222-1-cgel.zte@gmail.com
      
      
      Signed-off-by: default avatarGuo Ziliang <guo.ziliang@zte.com.cn>
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Reviewed-by: default avatarRan Xiaokai <ran.xiaokai@zte.com.cn>
      Reviewed-by: default avatarJiang Xuexin <jiang.xuexin@zte.com.cn>
      Reviewed-by: default avatarYang Yang <yang.yang29@zte.com.cn>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Roger Quadros <rogerq@kernel.org>
      Cc: Ziliang Guo <guo.ziliang@zte.com.cn>
      Cc: <stable@vger.kernel.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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fa3aa103
    • Joseph Qi's avatar
      ocfs2: fix crash when initialize filecheck kobj fails · df3301dc
      Joseph Qi authored
      commit 7b0b1332 upstream.
      
      Once s_root is set, genric_shutdown_super() will be called if
      fill_super() fails.  That means, we will call ocfs2_dismount_volume()
      twice in such case, which can lead to kernel crash.
      
      Fix this issue by initializing filecheck kobj before setting s_root.
      
      Link: https://lkml.kernel.org/r/20220310081930.86305-1-joseph.qi@linux.alibaba.com
      Fixes: 5f483c4a
      
       ("ocfs2: add kobject for online file check")
      Signed-off-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Changwei Ge <gechangwei@live.cn>
      Cc: Gang He <ghe@suse.com>
      Cc: Jun Piao <piaojun@huawei.com>
      Cc: <stable@vger.kernel.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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      df3301dc
    • Brian Masney's avatar
      crypto: qcom-rng - ensure buffer for generate is completely filled · 0f9b7b8d
      Brian Masney authored
      commit a680b183 upstream.
      
      The generate function in struct rng_alg expects that the destination
      buffer is completely filled if the function returns 0. qcom_rng_read()
      can run into a situation where the buffer is partially filled with
      randomness and the remaining part of the buffer is zeroed since
      qcom_rng_generate() doesn't check the return value. This issue can
      be reproduced by running the following from libkcapi:
      
          kcapi-rng -b 9000000 > OUTFILE
      
      The generated OUTFILE will have three huge sections that contain all
      zeros, and this is caused by the code where the test
      'val & PRNG_STATUS_DATA_AVAIL' fails.
      
      Let's fix this issue by ensuring that qcom_rng_read() always returns
      with a full buffer if the function returns success. Let's also have
      qcom_rng_generate() return the correct value.
      
      Here's some statistics from the ent project
      (https://www.fourmilab.ch/random/
      
      ) that shows information about the
      quality of the generated numbers:
      
          $ ent -c qcom-random-before
          Value Char Occurrences Fraction
            0           606748   0.067416
            1            33104   0.003678
            2            33001   0.003667
          ...
          253   �        32883   0.003654
          254   �        33035   0.003671
          255   �        33239   0.003693
      
          Total:       9000000   1.000000
      
          Entropy = 7.811590 bits per byte.
      
          Optimum compression would reduce the size
          of this 9000000 byte file by 2 percent.
      
          Chi square distribution for 9000000 samples is 9329962.81, and
          randomly would exceed this value less than 0.01 percent of the
          times.
      
          Arithmetic mean value of data bytes is 119.3731 (127.5 = random).
          Monte Carlo value for Pi is 3.197293333 (error 1.77 percent).
          Serial correlation coefficient is 0.159130 (totally uncorrelated =
          0.0).
      
      Without this patch, the results of the chi-square test is 0.01%, and
      the numbers are certainly not random according to ent's project page.
      The results improve with this patch:
      
          $ ent -c qcom-random-after
          Value Char Occurrences Fraction
            0            35432   0.003937
            1            35127   0.003903
            2            35424   0.003936
          ...
          253   �        35201   0.003911
          254   �        34835   0.003871
          255   �        35368   0.003930
      
          Total:       9000000   1.000000
      
          Entropy = 7.999979 bits per byte.
      
          Optimum compression would reduce the size
          of this 9000000 byte file by 0 percent.
      
          Chi square distribution for 9000000 samples is 258.77, and randomly
          would exceed this value 42.24 percent of the times.
      
          Arithmetic mean value of data bytes is 127.5006 (127.5 = random).
          Monte Carlo value for Pi is 3.141277333 (error 0.01 percent).
          Serial correlation coefficient is 0.000468 (totally uncorrelated =
          0.0).
      
      This change was tested on a Nexus 5 phone (msm8974 SoC).
      
      Signed-off-by: default avatarBrian Masney <bmasney@redhat.com>
      Fixes: ceec5f5b
      
       ("crypto: qcom-rng - Add Qcom prng driver")
      Cc: stable@vger.kernel.org # 4.19+
      Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Reviewed-by: default avatarAndrew Halaney <ahalaney@redhat.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0f9b7b8d
  2. Mar 19, 2022
  3. Mar 16, 2022