Skip to content
  1. Feb 10, 2021
  2. Feb 04, 2021
  3. Feb 03, 2021
    • Quanyang Wang's avatar
      drm/xlnx: fix kmemleak by sending vblank_event in atomic_disable · a7e02f77
      Quanyang Wang authored
      
      
      When running xrandr to change resolution of DP, the kmemleak as below
      can be observed:
      
      unreferenced object 0xffff00080a351000 (size 256):
        comm "Xorg", pid 248, jiffies 4294899614 (age 19.960s)
        hex dump (first 32 bytes):
          98 a0 bc 01 08 00 ff ff 01 00 00 00 00 00 00 00  ................
          ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<00000000e0bd0f69>] kmemleak_alloc+0x30/0x40
          [<00000000cde2f318>] kmem_cache_alloc+0x3d4/0x588
          [<0000000088ea9bd7>] drm_atomic_helper_setup_commit+0x84/0x5f8
          [<000000002290a264>] drm_atomic_helper_commit+0x58/0x388
          [<00000000f6ea78c3>] drm_atomic_commit+0x4c/0x60
          [<00000000c8e0725e>] drm_atomic_connector_commit_dpms+0xe8/0x110
          [<0000000020ade187>] drm_mode_obj_set_property_ioctl+0x1b0/0x450
          [<00000000918206d6>] drm_connector_property_set_ioctl+0x3c/0x68
          [<000000008d51e7a5>] drm_ioctl_kernel+0xc4/0x118
          [<000000002a819b75>] drm_ioctl+0x214/0x448
          [<000000008ca4e588>] __arm64_sys_ioctl+0xa8/0xf0
          [<0000000034e15a35>] el0_svc_common.constprop.0+0x74/0x190
          [<000000001b93d916>] do_el0_svc+0x24/0x90
          [<00000000ce9230e0>] el0_svc+0x14/0x20
          [<00000000e3607d82>] el0_sync_handler+0xb0/0xb8
          [<000000003e79c15f>] el0_sync+0x174/0x180
      
      This is because there is a scenario that a drm_crtc_commit commit is
      allocated but not freed. The drm subsystem require/release references
      to a CRTC commit by calling drm_crtc_commit_get/put, and when
      drm_crtc_commit_put find that commit.ref.refcount is zero, it will
      call __drm_crtc_commit_free to free this CRTC commit. Among these
      drm_crtc_commit_get/put pairs, there is a drm_crtc_commit_get in
      drm_atomic_helper_setup_commit as below:
      
      ...
      new_crtc_state->event->base.completion = &commit->flip_done;
      new_crtc_state->event->base.completion_release = release_crtc_commit;
      drm_crtc_commit_get(commit);
      ...
      
      This reference to the CRTC commit should be released at the function
      release_crtc_commit by calling e->completion_release(e->completion) in
      drm_send_event_locked. So we need to call drm_send_event_locked at
      two places: handling vblank event in the irq handler and the crtc disable
      helper. But in zynqmp_disp_crtc_atomic_disable, it only marks the flip
      is done and not call drm_crtc_commit_put. This result that the refcount
      of this commit is always non-zero and this commit will never be freed.
      
      Since the function drm_crtc_send_vblank_event has operations both sending
      a flip_done signal and releasing reference to the CRTC commit, let's use
      it instead.
      
      Signed-off-by: default avatarQuanyang Wang <quanyang.wang@windriver.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210202064121.173362-1-quanyang.wang@windriver.com
      a7e02f77
    • Maxime Ripard's avatar
      drm/vc4: hvs: Fix buffer overflow with the dlist handling · facd93f4
      Maxime Ripard authored
      Commit 0a038c1c ("drm/vc4: Move LBM creation out of
      vc4_plane_mode_set()") changed the LBM allocation logic from first
      allocating the LBM memory for the plane to running mode_set,
      adding a gap in the LBM, and then running the dlist allocation filling
      that gap.
      
      The gap was introduced by incrementing the dlist array index, but was
      never checking whether or not we were over the array length, leading
      eventually to memory corruptions if we ever crossed this limit.
      
      vc4_dlist_write had that logic though, and was reallocating a larger
      dlist array when reaching the end of the buffer. Let's share the logic
      between both functions.
      
      Cc: Boris Brezillon <boris.brezillon@collabora.com>
      Cc: Eric Anholt <eric@anholt.net>
      Fixes: 0a038c1c
      
       ("drm/vc4: Move LBM creation out of vc4_plane_mode_set()")
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Reviewed-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210129160647.128373-1-maxime@cerno.tech
      facd93f4
  4. Jan 28, 2021
  5. Jan 25, 2021
    • Dom Cobley's avatar
      drm/vc4: Correct POS1_SCL for hvs5 · f6b57101
      Dom Cobley authored
      Fixes failure with 4096x1080 resolutions
      
      [  284.315379] WARNING: CPU: 1 PID: 901 at drivers/gpu/drm/vc4/vc4_plane.c:981 vc4_plane_mode_set+0x1374/0x13c4
      [  284.315385] Modules linked in: ir_rc5_decoder rpivid_hevc(C) bcm2835_codec(C) bcm2835_isp(C) bcm2835_mmal_vchiq(C) bcm2835_gpiomem v4l2_mem2mem videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc cdc_acm xpad ir_rc6_decoder rc_rc6_mce gpio_ir_recv fuse
      [  284.315509] CPU: 1 PID: 901 Comm: kodi.bin Tainted: G         C        5.10.7 #1
      [  284.315514] Hardware name: BCM2711
      [  284.315518] Backtrace:
      [  284.315533] [<c0cc5ca0>] (dump_backtrace) from [<c0cc6014>] (show_stack+0x20/0x24)
      [  284.315540]  r7:ffffffff r6:00000000 r5:68000013 r4:c18ecf1c
      [  284.315549] [<c0cc5ff4>] (show_stack) from [<c0cca638>] (dump_stack+0xc4/0xf0)
      [  284.315558] [<c0cca574>] (dump_stack) from [<c022314c>] (__warn+0xfc/0x158)
      [  284.315564]  r9:00000000 r8:00000009 r7:000003d5 r6:00000009 r5:c08cc7dc r4:c0fd09b8
      [  284.315572] [<c0223050>] (__warn) from [<c0cc67ec>] (warn_slowpath_fmt+0x74/0xe4)
      [  284.315577]  r7:c08cc7dc r6:000003d5 r5:c0fd09b8 r4:00000000
      [  284.315584] [<c0cc677c>] (warn_slowpath_fmt) from [<c08cc7dc>] (vc4_plane_mode_set+0x1374/0x13c4)
      [  284.315589]  r8:00000000 r7:00000000 r6:00001000 r5:c404c600 r4:c2e34600
      [  284.315596] [<c08cb468>] (vc4_plane_mode_set) from [<c08cc984>] (vc4_plane_atomic_check+0x40/0x1c0)
      [  284.315601]  r10:00000001 r9:c2e34600 r8:c0e67068 r7:c0fc44e0 r6:c2ce3640 r5:c3d636c0
      [  284.315605]  r4:c2e34600
      [  284.315614] [<c08cc944>] (vc4_plane_atomic_check) from [<c0860504>] (drm_atomic_helper_check_planes+0xec/0x1ec)
      [  284.315620]  r9:c2e34600 r8:c0e67068 r7:c0fc44e0 r6:c2ce3640 r5:c3d636c0 r4:00000006
      [  284.315627] [<c0860418>] (drm_atomic_helper_check_planes) from [<c0860658>] (drm_atomic_helper_check+0x54/0x9c)
      [  284.315633]  r9:c2e35400 r8:00000006 r7:00000000 r6:c2ba7800 r5:c3d636c0 r4:00000000
      [  284.315641] [<c0860604>] (drm_atomic_helper_check) from [<c08b7ca8>] (vc4_atomic_check+0x25c/0x454)
      [  284.315645]  r7:00000000 r6:c2ba7800 r5:00000001 r4:c3d636c0
      [  284.315652] [<c08b7a4c>] (vc4_atomic_check) from [<c0881278>] (drm_atomic_check_only+0x5cc/0x7e0)
      [  284.315658]  r10:c404c6c8 r9:ffffffff r8:c472c480 r7:00000003 r6:c3d636c0 r5:00000000
      [  284.315662]  r4:0000003c r3:c08b7a4c
      [  284.315670] [<c0880cac>] (drm_atomic_check_only) from [<c089ba60>] (drm_mode_atomic_ioctl+0x758/0xa7c)
      [  284.315675]  r10:c3d46000 r9:c3d636c0 r8:c2ce8a70 r7:027e3a54 r6:00000043 r5:c1fbb800
      [  284.315679]  r4:0281a858
      [  284.315688] [<c089b308>] (drm_mode_atomic_ioctl) from [<c086e9f8>] (drm_ioctl_kernel+0xc4/0x108)
      [  284.315693]  r10:c03864bc r9:c1fbb800 r8:c3d47e64 r7:c089b308 r6:00000002 r5:c2ba7800
      [  284.315697]  r4:00000000
      [  284.315705] [<c086e934>] (drm_ioctl_kernel) from [<c086ee28>] (drm_ioctl+0x1e8/0x3a0)
      [  284.315711]  r9:c1fbb800 r8:000000bc r7:c3d47e64 r6:00000038 r5:c0e59570 r4:00000038
      [  284.315719] [<c086ec40>] (drm_ioctl) from [<c041f354>] (sys_ioctl+0x35c/0x914)
      [  284.315724]  r10:c2d08200 r9:00000000 r8:c36fa300 r7:befdd870 r6:c03864bc r5:c36fa301
      [  284.315728]  r4:c03864bc
      [  284.315735] [<c041eff8>] (sys_ioctl) from [<c0200040>] (ret_fast_syscall+0x0/0x28)
      [  284.315739] Exception stack(0xc3d47fa8 to 0xc3d47ff0)
      [  284.315745] 7fa0:                   027eb750 befdd870 00000000 c03864bc befdd870 00000000
      [  284.315750] 7fc0: 027eb750 befdd870 c03864bc 00000036 027e3948 0281a640 0281a850 027e3a50
      [  284.315756] 7fe0: b4b64100 befdd844 b4b5ba2c b49c994c
      [  284.315762]  r10:00000036 r9:c3d46000 r8:c0200204 r7:00000036 r6:c03864bc r5:befdd870
      [  284.315765]  r4:027eb750
      
      Fixes: c54619b0
      
       ("drm/vc4: Add support for the BCM2711 HVS5")
      Signed-off-by: default avatarDom Cobley <popcornmix@gmail.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Reviewed-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
      Tested-By: default avatarLucas Nussbaum <lucas@debian.org>
      Tested-By: default avatarRyutaroh Matsumoto <ryutaroh@ict.e.titech.ac.jp>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210121105759.1262699-2-maxime@cerno.tech
      f6b57101
    • Dom Cobley's avatar
      drm/vc4: Correct lbm size and calculation · 78e53303
      Dom Cobley authored
      LBM base address is measured in units of pixels per cycle.
      That is 4 for 2711 (hvs5) and 2 for 2708.
      
      We are wasting 75% of lbm by indexing without the scaling.
      But we were also using too high a size for the lbm resulting
      in partial corruption (right hand side) of vertically
      scaled images, usually at 4K or lower resolutions with more layers.
      
      The physical RAM of LBM on 2711 is 8 * 1920 * 16 * 12-bit
      (pixels are stored 12-bits per component regardless of format).
      
      The LBM address indexes work in units of pixels per clock,
      so for 4 pixels per clock that means we have 32 * 1920 = 60K
      
      Fixes: c54619b0
      
       ("drm/vc4: Add support for the BCM2711 HVS5")
      Signed-off-by: default avatarDom Cobley <popcornmix@gmail.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Reviewed-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
      Tested-By: default avatarLucas Nussbaum <lucas@debian.org>
      Tested-By: default avatarRyutaroh Matsumoto <ryutaroh@ict.e.titech.ac.jp>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210121105759.1262699-1-maxime@cerno.tech
      78e53303
  6. Jan 20, 2021
  7. Jan 19, 2021
  8. Jan 18, 2021
    • Nicolas Saenz Julienne's avatar
      drm/vc4: Unify PCM card's driver_name · 33c74535
      Nicolas Saenz Julienne authored
      
      
      User-space ALSA matches a card's driver name against an internal list of
      aliases in order to select the correct configuration for the system.
      When the driver name isn't defined, the match is performed against the
      card's name.
      
      With the introduction of RPi4 we now have two HDMI ports with two
      distinct audio cards. This is reflected in their names, making them
      different from previous RPi versions. With this, ALSA ultimately misses
      the board's configuration on RPi4.
      
      In order to avoid this, set "card->driver_name" to "vc4-hdmi"
      unanimously.
      
      Signed-off-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
      Fixes: f437bc1e
      
       ("drm/vc4: drv: Support BCM2711")
      Reviewed-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210115191209.12852-1-nsaenzjulienne@suse.de
      33c74535
    • Christian König's avatar
      drm/ttm: stop using GFP_TRANSHUGE_LIGHT · bf9eee24
      Christian König authored
      
      
      The only flag we really need is __GFP_NOMEMALLOC, highmem depends on
      dma32 and moveable/compound should never be set in the first place.
      
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Link: https://patchwork.freedesktop.org/patch/413812/
      Link: https://patchwork.freedesktop.org/patch/413964/
      Fixes: d099fc8f
      
       ("drm/ttm: new TT backend allocation pool v3")
      Reported-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      bf9eee24
    • Linus Torvalds's avatar
      Linux 5.11-rc4 · 19c329f6
      Linus Torvalds authored
      v5.11-rc4
      19c329f6
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-2021-01-17' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux · e2da7836
      Linus Torvalds authored
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Fix 'CPU too large' error in Intel PT
      
       - Correct event attribute sizes in 'perf inject'
      
       - Sync build_bug.h and kvm.h kernel copies
      
       - Fix bpf.h header include directive in 5sec.c 'perf trace' bpf example
      
       - libbpf tests fixes
      
       - Fix shadow stat 'perf test' for non-bash shells
      
       - Take cgroups into account for shadow stats in 'perf stat'
      
      * tag 'perf-tools-fixes-2021-01-17' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf inject: Correct event attribute sizes
        perf intel-pt: Fix 'CPU too large' error
        perf stat: Take cgroups into account for shadow stats
        perf stat: Introduce struct runtime_stat_data
        libperf tests: Fail when failing to get a tracepoint id
        libperf tests: If a test fails return non-zero
        libperf tests: Avoid uninitialized variable warning
        perf test: Fix shadow stat test for non-bash shells
        tools headers: Syncronize linux/build_bug.h with the kernel sources
        tools headers UAPI: Sync kvm.h headers with the kernel sources
        perf bpf examples: Fix bpf.h header include directive in 5sec.c example
      e2da7836
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.11-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · a1339d63
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "One fix for a lack of alignment in our linker script, that can lead to
        crashes depending on configuration etc.
      
        One fix for the 32-bit VDSO after the C VDSO conversion.
      
        Thanks to Andreas Schwab, Ariel Marcovitch, and Christophe Leroy"
      
      * tag 'powerpc-5.11-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/vdso: Fix clock_gettime_fallback for vdso32
        powerpc: Fix alignment bug within the init sections
      a1339d63
    • Linus Torvalds's avatar
      Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · a527a2b3
      Linus Torvalds authored
      Pull misc vfs fixes from Al Viro:
       "Several assorted fixes.
      
        I still think that audit ->d_name race is better fixed this way for
        the benefit of backports, with any possibly fancier variants done on
        top of it"
      
      * 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        dump_common_audit_data(): fix racy accesses to ->d_name
        iov_iter: fix the uaccess area in copy_compat_iovec_from_user
        umount(2): move the flag validity checks first
      a527a2b3
    • Linus Torvalds's avatar
      mm: don't put pinned pages into the swap cache · feb889fb
      Linus Torvalds authored
      So technically there is nothing wrong with adding a pinned page to the
      swap cache, but the pinning obviously means that the page can't actually
      be free'd right now anyway, so it's a bit pointless.
      
      However, the real problem is not with it being a bit pointless: the real
      issue is that after we've added it to the swap cache, we'll try to unmap
      the page.  That will succeed, because the code in mm/rmap.c doesn't know
      or care about pinned pages.
      
      Even the unmapping isn't fatal per se, since the page will stay around
      in memory due to the pinning, and we do hold the connection to it using
      the swap cache.  But when we then touch it next and take a page fault,
      the logic in do_swap_page() will map it back into the process as a
      possibly read-only page, and we'll then break the page association on
      the next COW fault.
      
      Honestly, this issue could have been fixed in any of those other places:
      (a) we could refuse to unmap a pinned page (which makes conceptual
      sense), or (b) we could make sure to re-map a pinned page writably in
      do_swap_page(), or (c) we could just make do_wp_page() not COW the
      pinned page (which was what we historically did before that "mm:
      do_wp_page() simplification" commit).
      
      But while all of them are equally valid models for breaking this chain,
      not putting pinned pages into the swap cache in the first place is the
      simplest one by far.
      
      It's also the safest one: the reason why do_wp_page() was changed in the
      first place was that getting the "can I re-use this page" wrong is so
      fraught with errors.  If you do it wrong, you end up with an incorrectly
      shared page.
      
      As a result, using "page_maybe_dma_pinned()" in either do_wp_page() or
      do_swap_page() would be a serious bug since it is only a (very good)
      heuristic.  Re-using the page requires a hard black-and-white rule with
      no room for ambiguity.
      
      In contrast, saying "this page is very likely dma pinned, so let's not
      add it to the swap cache and try to unmap it" is an obviously safe thing
      to do, and if the heuristic might very rarely be a false positive, no
      harm is done.
      
      Fixes: 09854ba9
      
       ("mm: do_wp_page() simplification")
      Reported-and-tested-by: default avatarMartin Raiber <martin@urbackup.org>
      Cc: Pavel Begunkov <asml.silence@gmail.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Peter Xu <peterx@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      feb889fb
  9. Jan 17, 2021
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 0da0a8a0
      Linus Torvalds authored
      
      
      Pull SCSI fixes from James Bottomley:
       "Nine minor fixes, seven in drivers and two in the core SCSI disk
        driver (sd) which should be harmless involving removing an unused
        variable and quietening a spurious warning"
      
      Signed-off-by: default avatarJames E.J. Bottomley <jejb@linux.ibm.com>
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: sd: Remove obsolete variable in sd_remove()
        scsi: sd: Suppress spurious errors when WRITE SAME is being disabled
        scsi: scsi_debug: Fix memleak in scsi_debug_init()
        scsi: mpt3sas: Fix spelling mistake in Kconfig "compatiblity" -> "compatibility"
        scsi: qedi: Correct max length of CHAP secret
        scsi: ufs: Correct the LUN used in eh_device_reset_handler() callback
        scsi: ufs: Relocate flush of exceptional event
        scsi: ufs: Relax the condition of UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL
        scsi: ufs: Fix possible power drain during system suspend
      0da0a8a0
    • Al Viro's avatar
      dump_common_audit_data(): fix racy accesses to ->d_name · d36a1dd9
      Al Viro authored
      
      
      We are not guaranteed the locking environment that would prevent
      dentry getting renamed right under us.  And it's possible for
      old long name to be freed after rename, leading to UAF here.
      
      Cc: stable@kernel.org # v2.6.2+
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      d36a1dd9
    • Linus Torvalds's avatar
      Merge tag 'block-5.11-2021-01-16' of git://git.kernel.dk/linux-block · 54c6247d
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "Just an nvme pull request via Christoph:
      
         - don't initialize hwmon for discover controllers (Sagi Grimberg)
      
         - fix iov_iter handling in nvme-tcp (Sagi Grimberg)
      
         - fix a preempt warning in nvme-tcp (Sagi Grimberg)
      
         - fix a possible NULL pointer dereference in nvme (Israel Rukshin)"
      
      * tag 'block-5.11-2021-01-16' of git://git.kernel.dk/linux-block:
        nvme: don't intialize hwmon for discovery controllers
        nvme-tcp: fix possible data corruption with bio merges
        nvme-tcp: Fix warning with CONFIG_DEBUG_PREEMPT
        nvmet-rdma: Fix NULL deref when setting pi_enable and traddr INADDR_ANY
      54c6247d
    • Linus Torvalds's avatar
      Merge tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block · 11c0239a
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
       "We still have a pending fix for a cancelation issue, but it's still
        being investigated. In the meantime:
      
         - Dead mm handling fix (Pavel)
      
         - SQPOLL setup error handling (Pavel)
      
         - Flush timeout sequence fix (Marcelo)
      
         - Missing finish_wait() for one exit case"
      
      * tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block:
        io_uring: ensure finish_wait() is always called in __io_uring_task_cancel()
        io_uring: flush timeouts that should already have expired
        io_uring: do sqo disable on install_fd error
        io_uring: fix null-deref in io_disable_sqo_submit
        io_uring: don't take files/mm for a dead task
        io_uring: drop mm and files after task_work_run
      11c0239a
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-5.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · acda701b
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
       "There are a few more fixes than a normal rc4, largely due to the
        bubble introduced by the holiday break:
      
         - return -ENOSYS for syscall number -1, which previously returned an
           uninitialized value.
      
         - ensure of_clk_init() has been called in time_init(), without which
           clock drivers may not be initialized.
      
         - fix sifive,uart0 driver to properly display the baud rate. A fix to
           initialize MPIE that allows interrupts to be processed during
           system calls.
      
         - avoid erronously begin tracing IRQs when interrupts are disabled,
           which at least triggers suprious lockdep failures.
      
         - workaround for a warning related to calling smp_processor_id()
           while preemptible. The warning itself is suprious on currently
           availiable systems.
      
         - properly include the generic time VDSO calls. A fix to our kasan
           address mapping. A fix to the HiFive Unleashed device tree, which
           allows the Ethernet PHY to be properly initialized by Linux (as
           opposed to relying on the bootloader).
      
         - defconfig update to include SiFive's GPIO driver, which is present
           on the HiFive Unleashed and necessary to initialize the PHY.
      
         - avoid allocating memory while initializing reserved memory.
      
         - avoid allocating the last 4K of memory, as pointers there alias
           with syscall errors.
      
        There are also two cleanups that should have no functional effect but
        do fix build warnings:
      
         - drop a duplicated definition of PAGE_KERNEL_EXEC.
      
         - properly declare the asm register SP shim.
      
         - cleanup the rv32 memory size Kconfig entry, to reflect the actual
           size of memory availiable"
      
      * tag 'riscv-for-linus-5.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        RISC-V: Fix maximum allowed phsyical memory for RV32
        RISC-V: Set current memblock limit
        RISC-V: Do not allocate memblock while iterating reserved memblocks
        riscv: stacktrace: Move register keyword to beginning of declaration
        riscv: defconfig: enable gpio support for HiFive Unleashed
        dts: phy: add GPIO number and active state used for phy reset
        dts: phy: fix missing mdio device and probe failure of vsc8541-01 device
        riscv: Fix KASAN memory mapping.
        riscv: Fixup CONFIG_GENERIC_TIME_VSYSCALL
        riscv: cacheinfo: Fix using smp_processor_id() in preemptible
        riscv: Trace irq on only interrupt is enabled
        riscv: Drop a duplicated PAGE_KERNEL_EXEC
        riscv: Enable interrupts during syscalls with M-Mode
        riscv: Fix sifive serial driver
        riscv: Fix kernel time_init()
        riscv: return -ENOSYS for syscall -1
      acda701b
    • Linus Torvalds's avatar
      mm: don't play games with pinned pages in clear_page_refs · 9348b73c
      Linus Torvalds authored
      
      
      Turning a pinned page read-only breaks the pinning after COW.  Don't do it.
      
      The whole "track page soft dirty" state doesn't work with pinned pages
      anyway, since the page might be dirtied by the pinning entity without
      ever being noticed in the page tables.
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9348b73c
    • Linus Torvalds's avatar
      mm: fix clear_refs_write locking · 29a951df
      Linus Torvalds authored
      
      
      Turning page table entries read-only requires the mmap_sem held for
      writing.
      
      So stop doing the odd games with turning things from read locks to write
      locks and back.  Just get the write lock.
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      29a951df
  10. Jan 16, 2021
    • Atish Patra's avatar
      RISC-V: Fix maximum allowed phsyical memory for RV32 · e5577937
      Atish Patra authored
      
      
      Linux kernel can only map 1GB of address space for RV32 as the page offset
      is set to 0xC0000000. The current description in the Kconfig is confusing
      as it indicates that RV32 can support 2GB of physical memory. That is
      simply not true for current kernel. In future, a 2GB split support can be
      added to allow 2GB physical address space.
      
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      Signed-off-by: default avatarAtish Patra <atish.patra@wdc.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      e5577937
    • Atish Patra's avatar
      RISC-V: Set current memblock limit · abb8e86b
      Atish Patra authored
      
      
      Currently, linux kernel can not use last 4k bytes of addressable space
      because IS_ERR_VALUE macro treats those as an error. This will be an issue
      for RV32 as any memblock allocator potentially allocate chunk of memory
      from the end of DRAM (2GB) leading bad address error even though the
      address was technically valid.
      
      Fix this issue by limiting the memblock if available memory spans the
      entire address space.
      
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      Signed-off-by: default avatarAtish Patra <atish.patra@wdc.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      abb8e86b
    • Atish Patra's avatar
      RISC-V: Do not allocate memblock while iterating reserved memblocks · 797f0375
      Atish Patra authored
      Currently, resource tree allocates memory blocks while iterating on the
      list. It leads to following kernel warning because memblock allocation
      also invokes memory block reservation API.
      
      [    0.000000] ------------[ cut here ]------------
      [    0.000000] WARNING: CPU: 0 PID: 0 at kernel/resource.c:795
      __insert_resource+0x8e/0xd0
      [    0.000000] Modules linked in:
      [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted
      5.10.0-00022-ge20097fb37e2-dirty #549
      [    0.000000] epc: c00125c2 ra : c001262c sp : c1c01f50
      [    0.000000]  gp : c1d456e0 tp : c1c0a980 t0 : ffffcf20
      [    0.000000]  t1 : 00000000 t2 : 00000000 s0 : c1c01f60
      [    0.000000]  s1 : ffffcf00 a0 : ffffff00 a1 : c1c0c0c4
      [    0.000000]  a2 : 80c12b15 a3 : 80402000 a4 : 80402000
      [    0.000000]  a5 : c1c0c0c4 a6 : 80c12b15 a7 : f5faf600
      [    0.000000]  s2 : c1c0c0c4 s3 : c1c0e000 s4 : c1009a80
      [    0.000000]  s5 : c1c0c000 s6 : c1d48000 s7 : c1613b4c
      [    0.000000]  s8 : 00000fff s9 : 80000200 s10: c1613b40
      [    0.000000]  s11: 00000000 t3 : c1d4a000 t4 : ffffffff
      
      This is also unnecessary as we can pre-compute the total memblocks required
      for each memory region and allocate it before the loop. It save precious
      boot time not going through memblock allocation code every time.
      
      Fixes: 00ab027a
      
       ("RISC-V: Add kernel image sections to the resource tree")
      
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      Tested-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarAtish Patra <atish.patra@wdc.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      797f0375
    • Christoph Hellwig's avatar
      iov_iter: fix the uaccess area in copy_compat_iovec_from_user · a959a978
      Christoph Hellwig authored
      sizeof needs to be called on the compat pointer, not the native one.
      
      Fixes: 89cd35c5
      
       ("iov_iter: transparently handle compat iovecs in import_iovec")
      Reported-by: default avatarDavid Laight <David.Laight@ACULAB.COM>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      a959a978
    • Linus Torvalds's avatar
      Merge tag 'for-5.11/dm-fixes-1' of... · 1d94330a
      Linus Torvalds authored
      Merge tag 'for-5.11/dm-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
      
      Pull device mapper fixes from Mike Snitzer:
      
       - Fix DM-raid's raid1 discard limits so discards work.
      
       - Select missing Kconfig dependencies for DM integrity and zoned
         targets.
      
       - Four fixes for DM crypt target's support to optionally bypass kcryptd
         workqueues.
      
       - Fix DM snapshot merge supports missing data flushes before committing
         metadata.
      
       - Fix DM integrity data device flushing when external metadata is used.
      
       - Fix DM integrity's maximum number of supported constructor arguments
         that user can request when creating an integrity device.
      
       - Eliminate DM core ioctl logging noise when an ioctl is issued without
         required CAP_SYS_RAWIO permission.
      
      * tag 'for-5.11/dm-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
        dm crypt: defer decryption to a tasklet if interrupts disabled
        dm integrity: fix the maximum number of arguments
        dm crypt: do not call bio_endio() from the dm-crypt tasklet
        dm integrity: fix flush with external metadata device
        dm: eliminate potential source of excessive kernel log noise
        dm snapshot: flush merged data before committing metadata
        dm crypt: use GFP_ATOMIC when allocating crypto requests from softirq
        dm crypt: do not wait for backlogged crypto request completion in softirq
        dm zoned: select CONFIG_CRC32
        dm integrity: select CRYPTO_SKCIPHER
        dm raid: fix discard limits for raid1
      1d94330a
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · b45e2da6
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "10 patches.
      
        Subsystems affected by this patch series: MAINTAINERS and mm (slub,
        pagealloc, memcg, kasan, vmalloc, migration, hugetlb, memory-failure,
        and process_vm_access)"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        mm/process_vm_access.c: include compat.h
        mm,hwpoison: fix printing of page flags
        MAINTAINERS: add Vlastimil as slab allocators maintainer
        mm/hugetlb: fix potential missing huge page size info
        mm: migrate: initialize err in do_migrate_pages
        mm/vmalloc.c: fix potential memory leak
        arm/kasan: fix the array size of kasan_early_shadow_pte[]
        mm/memcontrol: fix warning in mem_cgroup_page_lruvec()
        mm/page_alloc: add a missing mm_page_alloc_zone_locked() tracepoint
        mm, slub: consider rest of partial list if acquire_slab() fails
      b45e2da6
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · 8cbe71e7
      Linus Torvalds authored
      Pull rdma fixes from Jason Gunthorpe:
       "A fairly modest set of bug fixes, nothing abnormal from the merge
        window
      
        The ucma patch is a bit on the larger side, but given the regression
        was recently added I've opted to forward it to the rc stream.
      
         - Fix a ucma memory leak introduced in v5.9 while fixing the
           Syzkaller bugs
      
         - Don't fail when the xarray wraps for user verbs objects
      
         - User triggerable oops regression from the umem page size rework
      
         - Error unwind bugs in usnic, ocrdma, mlx5 and cma"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        RDMA/cma: Fix error flow in default_roce_mode_store
        RDMA/mlx5: Fix wrong free of blue flame register on error
        IB/mlx5: Fix error unwinding when set_has_smi_cap fails
        RDMA/umem: Avoid undefined behavior of rounddown_pow_of_two()
        RDMA/ocrdma: Fix use after free in ocrdma_dealloc_ucontext_pd()
        RDMA/usnic: Fix memleak in find_free_vf_and_create_qp_grp
        RDMA/restrack: Don't treat as an error allocation ID wrapping
        RDMA/ucma: Do not miss ctx destruction steps in some cases
      8cbe71e7
    • Jens Axboe's avatar
      io_uring: ensure finish_wait() is always called in __io_uring_task_cancel() · a8d13dbc
      Jens Axboe authored
      
      
      If we enter with requests pending and performm cancelations, we'll have
      a different inflight count before and after calling prepare_to_wait().
      This causes the loop to restart. If we actually ended up canceling
      everything, or everything completed in-between, then we'll break out
      of the loop without calling finish_wait() on the waitqueue. This can
      trigger a warning on exit_signals(), as we leave the task state in
      TASK_UNINTERRUPTIBLE.
      
      Put a finish_wait() after the loop to catch that case.
      
      Cc: stable@vger.kernel.org # 5.9+
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      a8d13dbc
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 0bc9bc1d
      Linus Torvalds authored
      Pull ext4 fixes from Ted Ts'o:
       "A number of bug fixes for ext4:
      
         - Fix for the new fast_commit feature
      
         - Fix some error handling codepaths in whiteout handling and
           mountpoint sampling
      
         - Fix how we write ext4_error information so it goes through the
           journal when journalling is active, to avoid races that can lead to
           lost error information, superblock checksum failures, or DIF/DIX
           features"
      
      * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: remove expensive flush on fast commit
        ext4: fix bug for rename with RENAME_WHITEOUT
        ext4: fix wrong list_splice in ext4_fc_cleanup
        ext4: use IS_ERR instead of IS_ERR_OR_NULL and set inode null when IS_ERR
        ext4: don't leak old mountpoint samples
        ext4: drop ext4_handle_dirty_super()
        ext4: fix superblock checksum failure when setting password salt
        ext4: use sbi instead of EXT4_SB(sb) in ext4_update_super()
        ext4: save error info to sb through journal if available
        ext4: protect superblock modifications with a buffer lock
        ext4: drop sync argument of ext4_commit_super()
        ext4: combine ext4_handle_error() and save_error_info()
      0bc9bc1d
    • Linus Torvalds's avatar
      Merge tag '5.11-rc3-smb3' of git://git.samba.org/sfrench/cifs-2.6 · 7cd3c412
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "Two small cifs fixes for stable (including an important handle leak
        fix) and three small cleanup patches"
      
      * tag '5.11-rc3-smb3' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: style: replace one-element array with flexible-array
        cifs: connect: style: Simplify bool comparison
        fs: cifs: remove unneeded variable in smb3_fs_context_dup
        cifs: fix interrupted close commands
        cifs: check pointer before freeing
      7cd3c412
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 82821be8
      Linus Torvalds authored
      Pull arm64 fixes from Catalin Marinas:
      
       - Set the minimum GCC version to 5.1 for arm64 due to earlier compiler
         bugs.
      
       - Make atomic helpers __always_inline to avoid a section mismatch when
         compiling with clang.
      
       - Fix the CMA and crashkernel reservations to use ZONE_DMA (remove the
         arm64_dma32_phys_limit variable, no longer needed with a dynamic
         ZONE_DMA sizing in 5.11).
      
       - Remove redundant IRQ flag tracing that was leaving lockdep
         inconsistent with the hardware state.
      
       - Revert perf events based hard lockup detector that was causing
         smp_processor_id() to be called in preemptible context.
      
       - Some trivial cleanups - spelling fix, renaming S_FRAME_SIZE to
         PT_REGS_SIZE, function prototypes added.
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: selftests: Fix spelling of 'Mismatch'
        arm64: syscall: include prototype for EL0 SVC functions
        compiler.h: Raise minimum version of GCC to 5.1 for arm64
        arm64: make atomic helpers __always_inline
        arm64: rename S_FRAME_SIZE to PT_REGS_SIZE
        Revert "arm64: Enable perf events based hard lockup detector"
        arm64: entry: remove redundant IRQ flag tracing
        arm64: Remove arm64_dma32_phys_limit and its uses
      82821be8