Skip to content
  1. Oct 09, 2020
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.9b-rc9-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 86f0a5fb
      Linus Torvalds authored
      Pull xen fix from Juergen Gross:
       "One fix for a regression when booting as a Xen guest on ARM64
        introduced probably during the 5.9 cycle. It is very low risk as it is
        modifying Xen specific code only.
      
        The exact commit introducing the bug hasn't been identified yet, but
        everything was fine in 5.8 and only in 5.9 some configurations started
        to fail"
      
      * tag 'for-linus-5.9b-rc9-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        arm/arm64: xen: Fix to convert percpu address to gfn correctly
      86f0a5fb
    • David Howells's avatar
      afs: Fix deadlock between writeback and truncate · ec0fa0b6
      David Howells authored
      The afs filesystem has a lock[*] that it uses to serialise I/O operations
      going to the server (vnode->io_lock), as the server will only perform one
      modification operation at a time on any given file or directory.  This
      prevents the the filesystem from filling up all the call slots to a server
      with calls that aren't going to be executed in parallel anyway, thereby
      allowing operations on other files to obtain slots.
      
        [*] Note that is probably redundant for directories at least since
            i_rwsem is used to serialise directory modifications and
            lookup/reading vs modification.  The server does allow parallel
            non-modification ops, however.
      
      When a file truncation op completes, we truncate the in-memory copy of the
      file to match - but we do it whilst still holding the io_lock, the idea
      being to prevent races with other operations.
      
      However, if writeback starts in a worker thread simultaneously with
      truncation (whilst notify_change() is called with i_rwsem locked, writeback
      pays it no heed), it may manage to set PG_writeback bits on the pages that
      will get truncated before afs_setattr_success() manages to call
      truncate_pagecache().  Truncate will then wait for those pages - whilst
      still inside io_lock:
      
          # cat /proc/8837/stack
          [<0>] wait_on_page_bit_common+0x184/0x1e7
          [<0>] truncate_inode_pages_range+0x37f/0x3eb
          [<0>] truncate_pagecache+0x3c/0x53
          [<0>] afs_setattr_success+0x4d/0x6e
          [<0>] afs_wait_for_operation+0xd8/0x169
          [<0>] afs_do_sync_operation+0x16/0x1f
          [<0>] afs_setattr+0x1fb/0x25d
          [<0>] notify_change+0x2cf/0x3c4
          [<0>] do_truncate+0x7f/0xb2
          [<0>] do_sys_ftruncate+0xd1/0x104
          [<0>] do_syscall_64+0x2d/0x3a
          [<0>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      The writeback operation, however, stalls indefinitely because it needs to
      get the io_lock to proceed:
      
          # cat /proc/5940/stack
          [<0>] afs_get_io_locks+0x58/0x1ae
          [<0>] afs_begin_vnode_operation+0xc7/0xd1
          [<0>] afs_store_data+0x1b2/0x2a3
          [<0>] afs_write_back_from_locked_page+0x418/0x57c
          [<0>] afs_writepages_region+0x196/0x224
          [<0>] afs_writepages+0x74/0x156
          [<0>] do_writepages+0x2d/0x56
          [<0>] __writeback_single_inode+0x84/0x207
          [<0>] writeback_sb_inodes+0x238/0x3cf
          [<0>] __writeback_inodes_wb+0x68/0x9f
          [<0>] wb_writeback+0x145/0x26c
          [<0>] wb_do_writeback+0x16a/0x194
          [<0>] wb_workfn+0x74/0x177
          [<0>] process_one_work+0x174/0x264
          [<0>] worker_thread+0x117/0x1b9
          [<0>] kthread+0xec/0xf1
          [<0>] ret_from_fork+0x1f/0x30
      
      and thus deadlock has occurred.
      
      Note that whilst afs_setattr() calls filemap_write_and_wait(), the fact
      that the caller is holding i_rwsem doesn't preclude more pages being
      dirtied through an mmap'd region.
      
      Fix this by:
      
       (1) Use the vnode validate_lock to mediate access between afs_setattr()
           and afs_writepages():
      
           (a) Exclusively lock validate_lock in afs_setattr() around the whole
           	 RPC operation.
      
           (b) If WB_SYNC_ALL isn't set on entry to afs_writepages(), trying to
           	 shared-lock validate_lock and returning immediately if we couldn't
           	 get it.
      
           (c) If WB_SYNC_ALL is set, wait for the lock.
      
           The validate_lock is also used to validate a file and to zap its cache
           if the file was altered by a third party, so it's probably a good fit
           for this.
      
       (2) Move the truncation outside of the io_lock in setattr, using the same
           hook as is used for local directory editing.
      
           This requires the old i_size to be retained in the operation record as
           we commit the revised status to the inode members inside the io_lock
           still, but we still need to know if we reduced the file size.
      
      Fixes: d2ddc776
      
       ("afs: Overhaul volume and server record caching and fileserver rotation")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ec0fa0b6
    • Linus Torvalds's avatar
      mm: avoid early COW write protect games during fork() · f3c64eda
      Linus Torvalds authored
      In commit 70e806e4 ("mm: Do early cow for pinned pages during fork()
      for ptes") we write-protected the PTE before doing the page pinning
      check, in order to avoid a race with concurrent fast-GUP pinning (which
      doesn't take the mm semaphore or the page table lock).
      
      That trick doesn't actually work - it doesn't handle memory ordering
      properly, and doing so would be prohibitively expensive.
      
      It also isn't really needed.  While we're moving in the direction of
      allowing and supporting page pinning without marking the pinned area
      with MADV_DONTFORK, the fact is that we've never really supported this
      kind of odd "concurrent fork() and page pinning", and doing the
      serialization on a pte level is just wrong.
      
      We can add serialization with a per-mm sequence counter, so we know how
      to solve that race properly, but we'll do that at a more appropriate
      time.  Right now this just removes the write protect games.
      
      It also turns out that the write protect games actually break on Power,
      as reported by Aneesh Kumar:
      
       "Architecture like ppc64 expects set_pte_at to be not used for updating
        a valid pte. This is further explained in commit 56eecdb9
      
       ("mm:
        Use ptep/pmdp_set_numa() for updating _PAGE_NUMA bit")"
      
      and the code triggered a warning there:
      
        WARNING: CPU: 0 PID: 30613 at arch/powerpc/mm/pgtable.c:185 set_pte_at+0x2a8/0x3a0 arch/powerpc/mm/pgtable.c:185
        Call Trace:
          copy_present_page mm/memory.c:857 [inline]
          copy_present_pte mm/memory.c:899 [inline]
          copy_pte_range mm/memory.c:1014 [inline]
          copy_pmd_range mm/memory.c:1092 [inline]
          copy_pud_range mm/memory.c:1127 [inline]
          copy_p4d_range mm/memory.c:1150 [inline]
          copy_page_range+0x1f6c/0x2cc0 mm/memory.c:1212
          dup_mmap kernel/fork.c:592 [inline]
          dup_mm+0x77c/0xab0 kernel/fork.c:1355
          copy_mm kernel/fork.c:1411 [inline]
          copy_process+0x1f00/0x2740 kernel/fork.c:2070
          _do_fork+0xc4/0x10b0 kernel/fork.c:2429
      
      Link: https://lore.kernel.org/lkml/CAHk-=wiWr+gO0Ro4LvnJBMs90OiePNyrE3E+pJvc9PzdBShdmw@mail.gmail.com/
      Link: https://lore.kernel.org/linuxppc-dev/20201008092541.398079-1-aneesh.kumar@linux.ibm.com/
      Reported-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Tested-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Kirill Shutemov <kirill@shutemov.name>
      Cc: Hugh Dickins <hughd@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f3c64eda
  2. Oct 07, 2020
    • Masami Hiramatsu's avatar
      arm/arm64: xen: Fix to convert percpu address to gfn correctly · 5a067711
      Masami Hiramatsu authored
      
      
      Use per_cpu_ptr_to_phys() instead of virt_to_phys() for per-cpu
      address conversion.
      
      In xen_starting_cpu(), per-cpu xen_vcpu_info address is converted
      to gfn by virt_to_gfn() macro. However, since the virt_to_gfn(v)
      assumes the given virtual address is in linear mapped kernel memory
      area, it can not convert the per-cpu memory if it is allocated on
      vmalloc area.
      
      This depends on CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK.
      If it is enabled, the first chunk of percpu memory is linear mapped.
      In the other case, that is allocated from vmalloc area. Moreover,
      if the first chunk of percpu has run out until allocating
      xen_vcpu_info, it will be allocated on the 2nd chunk, which is
      based on kernel memory or vmalloc memory (depends on
      CONFIG_NEED_PER_CPU_KM).
      
      Without this fix and kernel configured to use vmalloc area for
      the percpu memory, the Dom0 kernel will fail to boot with following
      errors.
      
      [    0.466172] Xen: initializing cpu0
      [    0.469601] ------------[ cut here ]------------
      [    0.474295] WARNING: CPU: 0 PID: 1 at arch/arm64/xen/../../arm/xen/enlighten.c:153 xen_starting_cpu+0x160/0x180
      [    0.484435] Modules linked in:
      [    0.487565] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.9.0-rc4+ #4
      [    0.493895] Hardware name: Socionext Developer Box (DT)
      [    0.499194] pstate: 00000005 (nzcv daif -PAN -UAO BTYPE=--)
      [    0.504836] pc : xen_starting_cpu+0x160/0x180
      [    0.509263] lr : xen_starting_cpu+0xb0/0x180
      [    0.513599] sp : ffff8000116cbb60
      [    0.516984] x29: ffff8000116cbb60 x28: ffff80000abec000
      [    0.522366] x27: 0000000000000000 x26: 0000000000000000
      [    0.527754] x25: ffff80001156c000 x24: fffffdffbfcdb600
      [    0.533129] x23: 0000000000000000 x22: 0000000000000000
      [    0.538511] x21: ffff8000113a99c8 x20: ffff800010fe4f68
      [    0.543892] x19: ffff8000113a9988 x18: 0000000000000010
      [    0.549274] x17: 0000000094fe0f81 x16: 00000000deadbeef
      [    0.554655] x15: ffffffffffffffff x14: 0720072007200720
      [    0.560037] x13: 0720072007200720 x12: 0720072007200720
      [    0.565418] x11: 0720072007200720 x10: 0720072007200720
      [    0.570801] x9 : ffff8000100fbdc0 x8 : ffff800010715208
      [    0.576182] x7 : 0000000000000054 x6 : ffff00001b790f00
      [    0.581564] x5 : ffff800010bbf880 x4 : 0000000000000000
      [    0.586945] x3 : 0000000000000000 x2 : ffff80000abec000
      [    0.592327] x1 : 000000000000002f x0 : 0000800000000000
      [    0.597716] Call trace:
      [    0.600232]  xen_starting_cpu+0x160/0x180
      [    0.604309]  cpuhp_invoke_callback+0xac/0x640
      [    0.608736]  cpuhp_issue_call+0xf4/0x150
      [    0.612728]  __cpuhp_setup_state_cpuslocked+0x128/0x2c8
      [    0.618030]  __cpuhp_setup_state+0x84/0xf8
      [    0.622192]  xen_guest_init+0x324/0x364
      [    0.626097]  do_one_initcall+0x54/0x250
      [    0.630003]  kernel_init_freeable+0x12c/0x2c8
      [    0.634428]  kernel_init+0x1c/0x128
      [    0.637988]  ret_from_fork+0x10/0x18
      [    0.641635] ---[ end trace d95b5309a33f8b27 ]---
      [    0.646337] ------------[ cut here ]------------
      [    0.651005] kernel BUG at arch/arm64/xen/../../arm/xen/enlighten.c:158!
      [    0.657697] Internal error: Oops - BUG: 0 [#1] SMP
      [    0.662548] Modules linked in:
      [    0.665676] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W         5.9.0-rc4+ #4
      [    0.673398] Hardware name: Socionext Developer Box (DT)
      [    0.678695] pstate: 00000005 (nzcv daif -PAN -UAO BTYPE=--)
      [    0.684338] pc : xen_starting_cpu+0x178/0x180
      [    0.688765] lr : xen_starting_cpu+0x144/0x180
      [    0.693188] sp : ffff8000116cbb60
      [    0.696573] x29: ffff8000116cbb60 x28: ffff80000abec000
      [    0.701955] x27: 0000000000000000 x26: 0000000000000000
      [    0.707344] x25: ffff80001156c000 x24: fffffdffbfcdb600
      [    0.712718] x23: 0000000000000000 x22: 0000000000000000
      [    0.718107] x21: ffff8000113a99c8 x20: ffff800010fe4f68
      [    0.723481] x19: ffff8000113a9988 x18: 0000000000000010
      [    0.728863] x17: 0000000094fe0f81 x16: 00000000deadbeef
      [    0.734245] x15: ffffffffffffffff x14: 0720072007200720
      [    0.739626] x13: 0720072007200720 x12: 0720072007200720
      [    0.745008] x11: 0720072007200720 x10: 0720072007200720
      [    0.750390] x9 : ffff8000100fbdc0 x8 : ffff800010715208
      [    0.755771] x7 : 0000000000000054 x6 : ffff00001b790f00
      [    0.761153] x5 : ffff800010bbf880 x4 : 0000000000000000
      [    0.766534] x3 : 0000000000000000 x2 : 00000000deadbeef
      [    0.771916] x1 : 00000000deadbeef x0 : ffffffffffffffea
      [    0.777304] Call trace:
      [    0.779819]  xen_starting_cpu+0x178/0x180
      [    0.783898]  cpuhp_invoke_callback+0xac/0x640
      [    0.788325]  cpuhp_issue_call+0xf4/0x150
      [    0.792317]  __cpuhp_setup_state_cpuslocked+0x128/0x2c8
      [    0.797619]  __cpuhp_setup_state+0x84/0xf8
      [    0.801779]  xen_guest_init+0x324/0x364
      [    0.805683]  do_one_initcall+0x54/0x250
      [    0.809590]  kernel_init_freeable+0x12c/0x2c8
      [    0.814016]  kernel_init+0x1c/0x128
      [    0.817583]  ret_from_fork+0x10/0x18
      [    0.821226] Code: d0006980 f9427c00 cb000300 17ffffea (d4210000)
      [    0.827415] ---[ end trace d95b5309a33f8b28 ]---
      [    0.832076] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
      [    0.839815] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---
      
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: default avatarStefano Stabellini <sstabellini@kernel.org>
      Link: https://lore.kernel.org/r/160196697165.60224.17470743378683334995.stgit@devnote2
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      5a067711
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · c85fb28b
      Linus Torvalds authored
      Pull arm64 fix from Catalin Marinas:
       "Fix a kernel panic in the AES crypto code caused by a BR tail call not
        matching the target BTI instruction (when branch target identification
        is enabled)"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        crypto: arm64: Use x16 with indirect branch to bti_c
      c85fb28b
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v5.9-3' of... · 6ec37e6b
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v5.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
      
      Pull another x86 platform driver fix from Hans de Goede:
       "One final pdx86 fix for Tablet Mode reporting regressions (which make
        the keyboard and touchpad unusable) on various Asus notebooks.
      
        These regressions were caused by the asus-nb-wmi and the intel-vbtn
        drivers both receiving recent patches to start reporting Tablet Mode /
        to report it on more models.
      
        Due to a miscommunication between Andy and me, Andy's earlier pull-req
        only contained the fix for the intel-vbtn driver and not the fix for
        the asus-nb-wmi code.
      
        This fix has been tested as a downstream patch in Fedora kernels for
        approx two weeks with no problems being reported"
      
      * tag 'platform-drivers-x86-v5.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
        platform/x86: asus-wmi: Fix SW_TABLET_MODE always reporting 1 on many different models
      6ec37e6b
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2020-10-06-1' of git://anongit.freedesktop.org/drm/drm · f1e141e9
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Daniel queued these up last week and I took a long weekend so didn't
        get them out, but fixing the OOB access on get font seems like
        something we should land and it's cc'ed stable as well.
      
        The other big change is a partial revert for a regression on android
        on the clcd fbdev driver, and one other docs fix.
      
        fbdev:
         - Re-add FB_ARMCLCD for android
         - Fix global-out-of-bounds read in fbcon_get_font()
      
        core:
         - Small doc fix"
      
      * tag 'drm-fixes-2020-10-06-1' of git://anongit.freedesktop.org/drm/drm:
        drm: drm_dsc.h: fix a kernel-doc markup
        Partially revert "video: fbdev: amba-clcd: Retire elder CLCD driver"
        fbcon: Fix global-out-of-bounds read in fbcon_get_font()
        Fonts: Support FONT_EXTRA_WORDS macros for built-in fonts
        fbdev, newport_con: Move FONT_EXTRA_WORDS macros into linux/font.h
      f1e141e9
    • Linus Torvalds's avatar
      usermodehelper: reset umask to default before executing user process · 4013c149
      Linus Torvalds authored
      
      
      Kernel threads intentionally do CLONE_FS in order to follow any changes
      that 'init' does to set up the root directory (or cwd).
      
      It is admittedly a bit odd, but it avoids the situation where 'init'
      does some extensive setup to initialize the system environment, and then
      we execute a usermode helper program, and it uses the original FS setup
      from boot time that may be very limited and incomplete.
      
      [ Both Al Viro and Eric Biederman point out that 'pivot_root()' will
        follow the root regardless, since it fixes up other users of root (see
        chroot_fs_refs() for details), but overmounting root and doing a
        chroot() would not. ]
      
      However, Vegard Nossum noticed that the CLONE_FS not only means that we
      follow the root and current working directories, it also means we share
      umask with whatever init changed it to. That wasn't intentional.
      
      Just reset umask to the original default (0022) before actually starting
      the usermode helper program.
      
      Reported-by: default avatarVegard Nossum <vegard.nossum@oracle.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Acked-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4013c149
    • Linus Torvalds's avatar
      splice: teach splice pipe reading about empty pipe buffers · d1a819a2
      Linus Torvalds authored
      Tetsuo Handa reports that splice() can return 0 before the real EOF, if
      the data in the splice source pipe is an empty pipe buffer.  That empty
      pipe buffer case doesn't happen in any normal situation, but you can
      trigger it by doing a write to a pipe that fails due to a page fault.
      
      Tetsuo has a test-case to show the behavior:
      
        #define _GNU_SOURCE
        #include <sys/types.h>
        #include <sys/stat.h>
        #include <fcntl.h>
        #include <unistd.h>
      
        int main(int argc, char *argv[])
        {
      	const int fd = open("/tmp/testfile", O_WRONLY | O_CREAT, 0600);
      	int pipe_fd[2] = { -1, -1 };
      	pipe(pipe_fd);
      	write(pipe_fd[1], NULL, 4096);
      	/* This splice() should wait unless interrupted. */
      	return !splice(pipe_fd[0], NULL, fd, NULL, 65536, 0);
        }
      
      which results in
      
          write(5, NULL, 4096)                    = -1 EFAULT (Bad address)
          splice(4, NULL, 3, NULL, 65536, 0)      = 0
      
      and this can confuse splice() users into believing they have hit EOF
      prematurely.
      
      The issue was introduced when the pipe write code started pre-allocating
      the pipe buffers before copying data from user space.
      
      This is modified verion of Tetsuo's original patch.
      
      Fixes: a194dfe6
      
       ("pipe: Rearrange sequence in pipe_write() to preallocate slot")
      Link:https://lore.kernel.org/linux-fsdevel/20201005121339.4063-1-penguin-kernel@I-love.SAKURA.ne.jp/
      Reported-by: default avatarTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
      Acked-by: default avatarTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d1a819a2
    • Jeremy Linton's avatar
      crypto: arm64: Use x16 with indirect branch to bti_c · 39e4716c
      Jeremy Linton authored
      The AES code uses a 'br x7' as part of a function called by
      a macro. That branch needs a bti_j as a target. This results
      in a panic as seen below. Using x16 (or x17) with an indirect
      branch keeps the target bti_c.
      
        Bad mode in Synchronous Abort handler detected on CPU1, code 0x34000003 -- BTI
        CPU: 1 PID: 265 Comm: cryptomgr_test Not tainted 5.8.11-300.fc33.aarch64 #1
        pstate: 20400c05 (nzCv daif +PAN -UAO BTYPE=j-)
        pc : aesbs_encrypt8+0x0/0x5f0 [aes_neon_bs]
        lr : aesbs_xts_encrypt+0x48/0xe0 [aes_neon_bs]
        sp : ffff80001052b730
      
        aesbs_encrypt8+0x0/0x5f0 [aes_neon_bs]
         __xts_crypt+0xb0/0x2dc [aes_neon_bs]
         xts_encrypt+0x28/0x3c [aes_neon_bs]
        crypto_skcipher_encrypt+0x50/0x84
        simd_skcipher_encrypt+0xc8/0xe0
        crypto_skcipher_encrypt+0x50/0x84
        test_skcipher_vec_cfg+0x224/0x5f0
        test_skcipher+0xbc/0x120
        alg_test_skcipher+0xa0/0x1b0
        alg_test+0x3dc/0x47c
        cryptomgr_test+0x38/0x60
      
      Fixes: 0e89640b
      
       ("crypto: arm64 - Use modern annotations for assembly functions")
      Cc: <stable@vger.kernel.org> # 5.6.x-
      Signed-off-by: default avatarJeremy Linton <jeremy.linton@arm.com>
      Suggested-by: default avatarDave P Martin <Dave.Martin@arm.com>
      Reviewed-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Reviewed-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20201006163326.2780619-1-jeremy.linton@arm.com
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      39e4716c
  3. Oct 06, 2020
    • Hans de Goede's avatar
      platform/x86: asus-wmi: Fix SW_TABLET_MODE always reporting 1 on many different models · 1797d588
      Hans de Goede authored
      Commit b0dbd97d ("platform/x86: asus-wmi: Add support for
      SW_TABLET_MODE") added support for reporting SW_TABLET_MODE using the
      Asus 0x00120063 WMI-device-id to see if various transformer models were
      docked into their keyboard-dock (SW_TABLET_MODE=0) or if they were
      being used as a tablet.
      
      The new SW_TABLET_MODE support (naively?) assumed that non Transformer
      devices would either not support the 0x00120063 WMI-device-id at all,
      or would NOT set ASUS_WMI_DSTS_PRESENCE_BIT in their reply when querying
      the device-id.
      
      Unfortunately this is not true and we have received many bug reports about
      this change causing the asus-wmi driver to always report SW_TABLET_MODE=1
      on non Transformer devices. This causes libinput to think that these are
      360 degree hinges style 2-in-1s folded into tablet-mode. Making libinput
      suppress keyboard and touchpad events from the builtin keyboard and
      touchpad. So effectively this causes the keyboard and touchpad to not work
      on many non Transformer Asus models.
      
      This commit fixes this by using the existing DMI based quirk mechanism in
      asus-nb-wmi.c to allow using the 0x00120063 device-id for reporting
      SW_TABLET_MODE on Transformer models and ignoring it on all other models.
      
      Fixes: b0dbd97d
      
       ("platform/x86: asus-wmi: Add support for SW_TABLET_MODE")
      Link: https://patchwork.kernel.org/patch/11780901/
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=209011
      BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1876997
      Reported-by: default avatarSamuel Čavoj <samuel@cavoj.net>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      1797d588
    • Dave Airlie's avatar
      Merge tag 'drm-misc-fixes-2020-10-01' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes · 86fdf61e
      Dave Airlie authored
      
      
      drm-misc-fixes for v5.9:
      - Small doc fix.
      - Re-add FB_ARMCLCD for android.
      - Fix global-out-of-bounds read in fbcon_get_font().
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/8585daa2-fcbc-3924-ac4f-e7b5668808e0@linux.intel.com
      86fdf61e
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v5.9-2' of git://git.infradead.org/linux-platform-drivers-x86 · 7575fdda
      Linus Torvalds authored
      Pull x86 platform driver fixes from Andy Shevchenko:
       "We have some fixes for Tablet Mode reporting in particular, that users
        are complaining a lot about.
      
        Summary:
      
         - Attempt #3 of enabling Tablet Mode reporting w/o regressions
      
         - Improve battery recognition code in ASUS WMI driver
      
         - Fix Kconfig dependency warning for Fujitsu and LG laptop drivers
      
         - Add fixes in Thinkpad ACPI driver for _BCL method and NVRAM polling
      
         - Fix power supply extended topology in Mellanox driver
      
         - Fix memory leak in OLPC EC driver
      
         - Avoid static struct device in Intel PMC core driver
      
         - Add support for the touchscreen found in MPMAN Converter9 2-in-1
      
         - Update MAINTAINERS to reflect the real state of affairs"
      
      * tag 'platform-drivers-x86-v5.9-2' of git://git.infradead.org/linux-platform-drivers-x86:
        platform/x86: thinkpad_acpi: re-initialize ACPI buffer size when reuse
        MAINTAINERS: Add Mark Gross and Hans de Goede as x86 platform drivers maintainers
        platform/x86: intel-vbtn: Switch to an allow-list for SW_TABLET_MODE reporting
        platform/x86: intel-vbtn: Revert "Fix SW_TABLET_MODE always reporting 1 on the HP Pavilion 11 x360"
        platform/x86: intel_pmc_core: do not create a static struct device
        platform/x86: mlx-platform: Fix extended topology configuration for power supply units
        platform/x86: pcengines-apuv2: Fix typo on define of AMD_FCH_GPIO_REG_GPIO55_DEVSLP0
        platform/x86: fix kconfig dependency warning for FUJITSU_LAPTOP
        platform/x86: fix kconfig dependency warning for LG_LAPTOP
        platform/x86: thinkpad_acpi: initialize tp_nvram_state variable
        platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on the HP Pavilion 11 x360
        platform/x86: asus-wmi: Add BATC battery name to the list of supported
        platform/x86: asus-nb-wmi: Revert "Do not load on Asus T100TA and T200TA"
        platform/x86: touchscreen_dmi: Add info for the MPMAN Converter9 2-in-1
        Documentation: laptops: thinkpad-acpi: fix underline length build warning
        Platform: OLPC: Fix memleak in olpc_ec_probe
      7575fdda
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 165563c0
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Make sure SKB control block is in the proper state during IPSEC
          ESP-in-TCP encapsulation. From Sabrina Dubroca.
      
       2) Various kinds of attributes were not being cloned properly when we
          build new xfrm_state objects from existing ones. Fix from Antony
          Antony.
      
       3) Make sure to keep BTF sections, from Tony Ambardar.
      
       4) TX DMA channels need proper locking in lantiq driver, from Hauke
          Mehrtens.
      
       5) Honour route MTU during forwarding, always. From Maciej
          Żenczykowski.
      
       6) Fix races in kTLS which can result in crashes, from Rohit
          Maheshwari.
      
       7) Skip TCP DSACKs with rediculous sequence ranges, from Priyaranjan
          Jha.
      
       8) Use correct address family in xfrm state lookups, from Herbert Xu.
      
       9) A bridge FDB flush should not clear out user managed fdb entries
          with the ext_learn flag set, from Nikolay Aleksandrov.
      
      10) Fix nested locking of netdev address lists, from Taehee Yoo.
      
      11) Fix handling of 32-bit DATA_FIN values in mptcp, from Mat Martineau.
      
      12) Fix r8169 data corruptions on RTL8402 chips, from Heiner Kallweit.
      
      13) Don't free command entries in mlx5 while comp handler could still be
          running, from Eran Ben Elisha.
      
      14) Error flow of request_irq() in mlx5 is busted, due to an off by one
          we try to free and IRQ never allocated. From Maor Gottlieb.
      
      15) Fix leak when dumping netlink policies, from Johannes Berg.
      
      16) Sendpage cannot be performed when a page is a slab page, or the page
          count is < 1. Some subsystems such as nvme were doing so. Create a
          "sendpage_ok()" helper and use it as needed, from Coly Li.
      
      17) Don't leak request socket when using syncookes with mptcp, from
          Paolo Abeni.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (111 commits)
        net/core: check length before updating Ethertype in skb_mpls_{push,pop}
        net: mvneta: fix double free of txq->buf
        net_sched: check error pointer in tcf_dump_walker()
        net: team: fix memory leak in __team_options_register
        net: typhoon: Fix a typo Typoon --> Typhoon
        net: hinic: fix DEVLINK build errors
        net: stmmac: Modify configuration method of EEE timers
        tcp: fix syn cookied MPTCP request socket leak
        libceph: use sendpage_ok() in ceph_tcp_sendpage()
        scsi: libiscsi: use sendpage_ok() in iscsi_tcp_segment_map()
        drbd: code cleanup by using sendpage_ok() to check page for kernel_sendpage()
        tcp: use sendpage_ok() to detect misused .sendpage
        nvme-tcp: check page by sendpage_ok() before calling kernel_sendpage()
        net: add WARN_ONCE in kernel_sendpage() for improper zero-copy send
        net: introduce helper sendpage_ok() in include/linux/net.h
        net: usb: pegasus: Proper error handing when setting pegasus' MAC address
        net: core: document two new elements of struct net_device
        netlink: fix policy dump leak
        net/mlx5e: Fix race condition on nhe->n pointer in neigh update
        net/mlx5e: Fix VLAN create flow
        ...
      165563c0
  4. Oct 05, 2020
  5. Oct 04, 2020
    • Christophe JAILLET's avatar
      790ca79d
    • Randy Dunlap's avatar
      net: hinic: fix DEVLINK build errors · 1f7e877c
      Randy Dunlap authored
      Fix many (lots deleted here) build errors in hinic by selecting NET_DEVLINK.
      
      ld: drivers/net/ethernet/huawei/hinic/hinic_hw_dev.o: in function `mgmt_watchdog_timeout_event_handler':
      hinic_hw_dev.c:(.text+0x30a): undefined reference to `devlink_health_report'
      ld: drivers/net/ethernet/huawei/hinic/hinic_devlink.o: in function `hinic_fw_reporter_dump':
      hinic_devlink.c:(.text+0x1c): undefined reference to `devlink_fmsg_u32_pair_put'
      ld: drivers/net/ethernet/huawei/hinic/hinic_devlink.o: in function `hinic_fw_reporter_dump':
      hinic_devlink.c:(.text+0x126): undefined reference to `devlink_fmsg_binary_pair_put'
      ld: drivers/net/ethernet/huawei/hinic/hinic_devlink.o: in function `hinic_hw_reporter_dump':
      hinic_devlink.c:(.text+0x1ba): undefined reference to `devlink_fmsg_string_pair_put'
      ld: hinic_devlink.c:(.text+0x227): undefined reference to `devlink_fmsg_u8_pair_put'
      ld: drivers/net/ethernet/huawei/hinic/hinic_devlink.o: in function `hinic_devlink_alloc':
      hinic_devlink.c:(.text+0xaee): undefined reference to `devlink_alloc'
      ld: drivers/net/ethernet/huawei/hinic/hinic_devlink.o: in function `hinic_devlink_free':
      hinic_devlink.c:(.text+0xb04): undefined reference to `devlink_free'
      ld: drivers/net/ethernet/huawei/hinic/hinic_devlink.o: in function `hinic_devlink_register':
      hinic_devlink.c:(.text+0xb26): undefined reference to `devlink_register'
      ld: drivers/net/ethernet/huawei/hinic/hinic_devlink.o: in function `hinic_devlink_unregister':
      hinic_devlink.c:(.text+0xb46): undefined reference to `devlink_unregister'
      ld: drivers/net/ethernet/huawei/hinic/hinic_devlink.o: in function `hinic_health_reporters_create':
      hinic_devlink.c:(.text+0xb75): undefined reference to `devlink_health_reporter_create'
      ld: hinic_devlink.c:(.text+0xb95): undefined reference to `devlink_health_reporter_create'
      ld: hinic_devlink.c:(.text+0xbac): undefined reference to `devlink_health_reporter_destroy'
      ld: drivers/net/ethernet/huawei/hinic/hinic_devlink.o: in function `hinic_health_reporters_destroy':
      
      Fixes: 51ba902a
      
       ("net-next/hinic: Initialize hw interface")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Bin Luo <luobin9@huawei.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Aviad Krawczyk <aviad.krawczyk@huawei.com>
      Cc: Zhao Chen <zhaochen6@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f7e877c
    • Vineetha G. Jaya Kumaran's avatar
      net: stmmac: Modify configuration method of EEE timers · 388e201d
      Vineetha G. Jaya Kumaran authored
      Ethtool manual stated that the tx-timer is the "the amount of time the
      device should stay in idle mode prior to asserting its Tx LPI". The
      previous implementation for "ethtool --set-eee tx-timer" sets the LPI TW
      timer duration which is not correct. Hence, this patch fixes the
      "ethtool --set-eee tx-timer" to configure the EEE LPI timer.
      
      The LPI TW Timer will be using the defined default value instead of
      "ethtool --set-eee tx-timer" which follows the EEE LS timer implementation.
      
      Changelog V2
      *Not removing/modifying the eee_timer.
      *EEE LPI timer can be configured through ethtool and also the eee_timer
      module param.
      *EEE TW Timer will be configured with default value only, not able to be
      configured through ethtool or module param. This follows the implementation
      of the EEE LS Timer.
      
      Fixes: d765955d
      
       ("stmmac: add the Energy Efficient Ethernet support")
      Signed-off-by: default avatarVineetha G. Jaya Kumaran <vineetha.g.jaya.kumaran@intel.com>
      Signed-off-by: default avatarVoon Weifeng <weifeng.voon@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      388e201d
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 22fbc037
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "Two bugfixes"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: VMX: update PFEC_MASK/PFEC_MATCH together with PF intercept
        KVM: arm64: Restore missing ISB on nVHE __tlb_switch_to_guest
      22fbc037
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.9b-rc8-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 5ee56135
      Linus Torvalds authored
      Pull xen fix from Juergen Gross:
       "Fix a regression introduced in 5.9-rc3 which caused a system running
        as fully virtualized guest under Xen to crash when using legacy
        devices like a floppy"
      
      * tag 'for-linus-5.9b-rc8-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen/events: don't use chip_data for legacy IRQs
      5ee56135
    • Linus Torvalds's avatar
      Merge tag 'usb-5.9-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 5f056638
      Linus Torvalds authored
      Pull USB/PHY fixes from Greg KH:
       "Here are some small USB and PHY driver fixes for 5.9-rc8
      
        The PHY driver fix resolves an issue found by Dan Carpenter for a
        memory leak.
      
        The USB fixes fall into two groups:
      
         - usb gadget fix from Bryan that is a fix for a previous security fix
           that showed up in in-the-wild testing
      
         - usb core driver matching bugfixes. This fixes a bug that has
           plagued the both the usbip driver and syzbot testing tools this -rc
           release cycle. All is now working properly so usbip connections
           will work, and syzbot can get back to fuzzing USB drivers properly.
      
        All have been in linux-next for a while with no reported issues"
      
      * tag 'usb-5.9-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usbcore/driver: Accommodate usbip
        usbcore/driver: Fix incorrect downcast
        usbcore/driver: Fix specific driver selection
        Revert "usbip: Implement a match function to fix usbip"
        USB: gadget: f_ncm: Fix NDP16 datagram validation
        phy: ti: am654: Fix a leak in serdes_am654_probe()
      5f056638
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · f35c08e0
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "Some more driver fixes for i2c"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: npcm7xx: Clear LAST bit after a failed transaction.
        i2c: cpm: Fix i2c_ram structure
        i2c: i801: Exclude device from suspend direct complete optimization
      f35c08e0
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · 72af7b41
      Linus Torvalds authored
      Pull input fixes from Dmitry Torokhov:
       "A couple more driver quirks, now enabling newer trackpoints from
        Synaptics for real"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
        Input: i8042 - add nopnp quirk for Acer Aspire 5 A515
        Input: trackpoint - enable Synaptics trackpoints
      72af7b41
    • Eric Biggers's avatar
      scripts/spelling.txt: fix malformed entry · d43ca138
      Eric Biggers authored
      
      
      One of the entries has three fields "mistake||correction||correction"
      rather than the expected two fields "mistake||correction".  Fix it.
      
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Link: https://lkml.kernel.org/r/20200930234359.255295-1-ebiggers@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d43ca138
    • Joonsoo Kim's avatar
      mm/page_alloc: handle a missing case for memalloc_nocma_{save/restore} APIs · 1d91df85
      Joonsoo Kim authored
      memalloc_nocma_{save/restore} APIs can be used to skip page allocation
      on CMA area, but, there is a missing case and the page on CMA area could
      be allocated even if APIs are used.  This patch handles this case to fix
      the potential issue.
      
      For now, these APIs are used to prevent long-term pinning on the CMA
      page.  When the long-term pinning is requested on the CMA page, it is
      migrated to the non-CMA page before pinning.  This non-CMA page is
      allocated by using memalloc_nocma_{save/restore} APIs.  If APIs doesn't
      work as intended, the CMA page is allocated and it is pinned for a long
      time.  This long-term pin for the CMA page causes cma_alloc() failure
      and it could result in wrong behaviour on the device driver who uses the
      cma_alloc().
      
      Missing case is an allocation from the pcplist.  MIGRATE_MOVABLE pcplist
      could have the pages on CMA area so we need to skip it if ALLOC_CMA
      isn't specified.
      
      Fixes: 8510e69c
      
       (mm/page_alloc: fix memalloc_nocma_{save/restore} APIs)
      Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Link: https://lkml.kernel.org/r/1601429472-12599-1-git-send-email-iamjoonsoo.kim@lge.com
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1d91df85
    • Eric Farman's avatar
      mm, slub: restore initial kmem_cache flags · 484cfaca
      Eric Farman authored
      The routine that applies debug flags to the kmem_cache slabs
      inadvertantly prevents non-debug flags from being applied to those
      same objects.  That is, if slub_debug=<flag>,<slab> is specified,
      non-debugged slabs will end up having flags of zero, and the slabs
      may be unusable.
      
      Fix this by including the input flags for non-matching slabs with the
      contents of slub_debug, so that the caches are created as expected
      alongside any debugging options that may be requested.  With this, we
      can remove the check for a NULL slub_debug_string, since it's covered
      by the loop itself.
      
      Fixes: e17f1dfb
      
       ("mm, slub: extend slub_debug syntax for multiple blocks")
      Signed-off-by: default avatarEric Farman <farman@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Link: https://lkml.kernel.org/r/20200930161931.28575-1-farman@linux.ibm.com
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      484cfaca
  6. Oct 03, 2020
    • Paolo Bonzini's avatar
      Merge tag 'kvmarm-fixes-5.9-3' of... · e2e1a1c8
      Paolo Bonzini authored
      Merge tag 'kvmarm-fixes-5.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into kvm-master
      
      KVM/arm64 fixes for 5.9, take #3
      
      - Fix synchronization of VTTBR update on TLB invalidation for nVHE systems
      e2e1a1c8
    • Paolo Bonzini's avatar
      KVM: VMX: update PFEC_MASK/PFEC_MATCH together with PF intercept · b502e6ec
      Paolo Bonzini authored
      
      
      The PFEC_MASK and PFEC_MATCH fields in the VMCS reverse the meaning of
      the #PF intercept bit in the exception bitmap when they do not match.
      This means that, if PFEC_MASK and/or PFEC_MATCH are set, the
      hypervisor can get a vmexit for #PF exceptions even when the
      corresponding bit is clear in the exception bitmap.
      
      This is unexpected and is promptly detected by a WARN_ON_ONCE.
      To fix it, reset PFEC_MASK and PFEC_MATCH when the #PF intercept
      is disabled (as is common with enable_ept && !allow_smaller_maxphyaddr).
      
      Reported-by: default avatarQian Cai <cai@redhat.com&gt;>
      Reported-by: default avatarNaresh Kamboju <naresh.kamboju@linaro.org>
      Tested-by: default avatarNaresh Kamboju <naresh.kamboju@linaro.org>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b502e6ec
    • David S. Miller's avatar
      Merge tag 'mlx5-fixes-2020-09-30' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · ab0faf5f
      David S. Miller authored
      
      
      From: Saeed Mahameed <saeedm@nvidia.com>
      
      ====================
      This series introduces some fixes to mlx5 driver.
      
      v1->v2:
       - Patch #1 Don't return while mutex is held. (Dave)
      
      v2->v3:
       - Drop patch #1, will consider a better approach (Jakub)
       - use cpu_relax() instead of cond_resched() (Jakub)
       - while(i--) to reveres a loop (Jakub)
       - Drop old mellanox email sign-off and change the committer email
         (Jakub)
      
      Please pull and let me know if there is any problem.
      
      For -stable v4.15
       ('net/mlx5e: Fix VLAN cleanup flow')
       ('net/mlx5e: Fix VLAN create flow')
      
      For -stable v4.16
       ('net/mlx5: Fix request_irqs error flow')
      
      For -stable v5.4
       ('net/mlx5e: Add resiliency in Striding RQ mode for packets larger than MTU')
       ('net/mlx5: Avoid possible free of command entry while timeout comp handler')
      
      For -stable v5.7
       ('net/mlx5e: Fix return status when setting unsupported FEC mode')
      
      For -stable v5.8
       ('net/mlx5e: Fix race condition on nhe->n pointer in neigh update')
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ab0faf5f
    • Paolo Abeni's avatar
      tcp: fix syn cookied MPTCP request socket leak · 9d8c05ad
      Paolo Abeni authored
      If a syn-cookies request socket don't pass MPTCP-level
      validation done in syn_recv_sock(), we need to release
      it immediately, or it will be leaked.
      
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/89
      Fixes: 9466a1cc
      
       ("mptcp: enable JOIN requests even if cookies are in use")
      Reported-and-tested-by: default avatarGeliang Tang <geliangtang@gmail.com>
      Reviewed-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9d8c05ad
    • David S. Miller's avatar
      Merge branch 'Introduce-sendpage_ok-to-detect-misused-sendpage-in-network-related-drivers' · e7d4005d
      David S. Miller authored
      
      
      Coly Li says:
      
      ====================
      Introduce sendpage_ok() to detect misused sendpage in network related drivers
      
      As Sagi Grimberg suggested, the original fix is refind to a more common
      inline routine:
          static inline bool sendpage_ok(struct page *page)
          {
              return  (!PageSlab(page) && page_count(page) >= 1);
          }
      If sendpage_ok() returns true, the checking page can be handled by the
      concrete zero-copy sendpage method in network layer.
      
      The v10 series has 7 patches, fixes a WARN_ONCE() usage from v9 series,
      - The 1st patch in this series introduces sendpage_ok() in header file
        include/linux/net.h.
      - The 2nd patch adds WARN_ONCE() for improper zero-copy send in
        kernel_sendpage().
      - The 3rd patch fixes the page checking issue in nvme-over-tcp driver.
      - The 4th patch adds page_count check by using sendpage_ok() in
        do_tcp_sendpages() as Eric Dumazet suggested.
      - The 5th and 6th patches just replace existing open coded checks with
        the inline sendpage_ok() routine.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e7d4005d
    • Coly Li's avatar
      libceph: use sendpage_ok() in ceph_tcp_sendpage() · 40efc4dc
      Coly Li authored
      
      
      In libceph, ceph_tcp_sendpage() does the following checks before handle
      the page by network layer's zero copy sendpage method,
      	if (page_count(page) >= 1 && !PageSlab(page))
      
      This check is exactly what sendpage_ok() does. This patch replace the
      open coded checks by sendpage_ok() as a code cleanup.
      
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Acked-by: default avatarJeff Layton <jlayton@kernel.org>
      Cc: Ilya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      40efc4dc
    • Coly Li's avatar
      scsi: libiscsi: use sendpage_ok() in iscsi_tcp_segment_map() · 6aa25c73
      Coly Li authored
      
      
      In iscsci driver, iscsi_tcp_segment_map() uses the following code to
      check whether the page should or not be handled by sendpage:
          if (!recv && page_count(sg_page(sg)) >= 1 && !PageSlab(sg_page(sg)))
      
      The "page_count(sg_page(sg)) >= 1 && !PageSlab(sg_page(sg)" part is to
      make sure the page can be sent to network layer's zero copy path. This
      part is exactly what sendpage_ok() does.
      
      This patch uses  use sendpage_ok() in iscsi_tcp_segment_map() to replace
      the original open coded checks.
      
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reviewed-by: default avatarLee Duncan <lduncan@suse.com>
      Acked-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Cc: Vasily Averin <vvs@virtuozzo.com>
      Cc: Cong Wang <amwang@redhat.com>
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Cc: Chris Leech <cleech@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6aa25c73
    • Coly Li's avatar
      drbd: code cleanup by using sendpage_ok() to check page for kernel_sendpage() · fb25ebe1
      Coly Li authored
      
      
      In _drbd_send_page() a page is checked by following code before sending
      it by kernel_sendpage(),
              (page_count(page) < 1) || PageSlab(page)
      If the check is true, this page won't be send by kernel_sendpage() and
      handled by sock_no_sendpage().
      
      This kind of check is exactly what macro sendpage_ok() does, which is
      introduced into include/linux/net.h to solve a similar send page issue
      in nvme-tcp code.
      
      This patch uses macro sendpage_ok() to replace the open coded checks to
      page type and refcount in _drbd_send_page(), as a code cleanup.
      
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Cc: Philipp Reisner <philipp.reisner@linbit.com>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fb25ebe1
    • Coly Li's avatar
      tcp: use sendpage_ok() to detect misused .sendpage · cf83a17e
      Coly Li authored
      commit a10674bf ("tcp: detecting the misuse of .sendpage for Slab
      objects") adds the checks for Slab pages, but the pages don't have
      page_count are still missing from the check.
      
      Network layer's sendpage method is not designed to send page_count 0
      pages neither, therefore both PageSlab() and page_count() should be
      both checked for the sending page. This is exactly what sendpage_ok()
      does.
      
      This patch uses sendpage_ok() in do_tcp_sendpages() to detect misused
      .sendpage, to make the code more robust.
      
      Fixes: a10674bf
      
       ("tcp: detecting the misuse of .sendpage for Slab objects")
      Suggested-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Cc: Vasily Averin <vvs@virtuozzo.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cf83a17e