Skip to content
Snippets Groups Projects
  1. Dec 11, 2020
    • Greg Kroah-Hartman's avatar
    • Masami Hiramatsu's avatar
      x86/uprobes: Do not use prefixes.nbytes when looping over prefixes.bytes · ec5aa25d
      Masami Hiramatsu authored
      
      commit 4e9a5ae8 upstream
      
      Since insn.prefixes.nbytes can be bigger than the size of
      insn.prefixes.bytes[] when a prefix is repeated, the proper check must
      be
      
        insn.prefixes.bytes[i] != 0 and i < 4
      
      instead of using insn.prefixes.nbytes.
      
      Introduce a for_each_insn_prefix() macro for this purpose. Debugged by
      Kees Cook <keescook@chromium.org>.
      
       [ bp: Massage commit message, sync with the respective header in tools/
         and drop "we". ]
      
      Fixes: 2b144498 ("uprobes, mm, x86: Add the ability to install and remove uprobes breakpoints")
      Reported-by: default avatar <syzbot+9b64b619f10f19d19a7c@syzkaller.appspotmail.com>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/160697103739.3146288.7437620795200799020.stgit@devnote2
      
      
      [sudip: adjust context, drop change of insn.h in tools]
      Signed-off-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec5aa25d
    • Luo Meng's avatar
      Input: i8042 - fix error return code in i8042_setup_aux() · e233035a
      Luo Meng authored
      
      commit 855b6985 upstream.
      
      Fix to return a negative error code from the error handling case
      instead of 0 in function i8042_setup_aux(), as done elsewhere in this
      function.
      
      Fixes: f8113416 ("Input: i8042 - use platform_driver_probe")
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarLuo Meng <luomeng12@huawei.com>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20201123133420.4071187-1-luomeng12@huawei.com
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e233035a
    • Bob Peterson's avatar
      gfs2: check for empty rgrp tree in gfs2_ri_update · 3bce7636
      Bob Peterson authored
      
      commit 77872151 upstream.
      
      If gfs2 tries to mount a (corrupt) file system that has no resource
      groups it still tries to set preferences on the first one, which causes
      a kernel null pointer dereference. This patch adds a check to function
      gfs2_ri_update so this condition is detected and reported back as an
      error.
      
      Reported-by: default avatar <syzbot+e3f23ce40269a4c9053a@syzkaller.appspotmail.com>
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3bce7636
    • Gerald Schaefer's avatar
      mm/userfaultfd: do not access vma->vm_mm after calling handle_userfault() · a96661f5
      Gerald Schaefer authored
      
      commit bfe8cc1d upstream.
      
      Alexander reported a syzkaller / KASAN finding on s390, see below for
      complete output.
      
      In do_huge_pmd_anonymous_page(), the pre-allocated pagetable will be
      freed in some cases.  In the case of userfaultfd_missing(), this will
      happen after calling handle_userfault(), which might have released the
      mmap_lock.  Therefore, the following pte_free(vma->vm_mm, pgtable) will
      access an unstable vma->vm_mm, which could have been freed or re-used
      already.
      
      For all architectures other than s390 this will go w/o any negative
      impact, because pte_free() simply frees the page and ignores the
      passed-in mm.  The implementation for SPARC32 would also access
      mm->page_table_lock for pte_free(), but there is no THP support in
      SPARC32, so the buggy code path will not be used there.
      
      For s390, the mm->context.pgtable_list is being used to maintain the 2K
      pagetable fragments, and operating on an already freed or even re-used
      mm could result in various more or less subtle bugs due to list /
      pagetable corruption.
      
      Fix this by calling pte_free() before handle_userfault(), similar to how
      it is already done in __do_huge_pmd_anonymous_page() for the WRITE /
      non-huge_zero_page case.
      
      Commit 6b251fc9 ("userfaultfd: call handle_userfault() for
      userfaultfd_missing() faults") actually introduced both, the
      do_huge_pmd_anonymous_page() and also __do_huge_pmd_anonymous_page()
      changes wrt to calling handle_userfault(), but only in the latter case
      it put the pte_free() before calling handle_userfault().
      
        BUG: KASAN: use-after-free in do_huge_pmd_anonymous_page+0xcda/0xd90 mm/huge_memory.c:744
        Read of size 8 at addr 00000000962d6988 by task syz-executor.0/9334
      
        CPU: 1 PID: 9334 Comm: syz-executor.0 Not tainted 5.10.0-rc1-syzkaller-07083-g4c9720875573 #0
        Hardware name: IBM 3906 M04 701 (KVM/Linux)
        Call Trace:
          do_huge_pmd_anonymous_page+0xcda/0xd90 mm/huge_memory.c:744
          create_huge_pmd mm/memory.c:4256 [inline]
          __handle_mm_fault+0xe6e/0x1068 mm/memory.c:4480
          handle_mm_fault+0x288/0x748 mm/memory.c:4607
          do_exception+0x394/0xae0 arch/s390/mm/fault.c:479
          do_dat_exception+0x34/0x80 arch/s390/mm/fault.c:567
          pgm_check_handler+0x1da/0x22c arch/s390/kernel/entry.S:706
          copy_from_user_mvcos arch/s390/lib/uaccess.c:111 [inline]
          raw_copy_from_user+0x3a/0x88 arch/s390/lib/uaccess.c:174
          _copy_from_user+0x48/0xa8 lib/usercopy.c:16
          copy_from_user include/linux/uaccess.h:192 [inline]
          __do_sys_sigaltstack kernel/signal.c:4064 [inline]
          __s390x_sys_sigaltstack+0xc8/0x240 kernel/signal.c:4060
          system_call+0xe0/0x28c arch/s390/kernel/entry.S:415
      
        Allocated by task 9334:
          slab_alloc_node mm/slub.c:2891 [inline]
          slab_alloc mm/slub.c:2899 [inline]
          kmem_cache_alloc+0x118/0x348 mm/slub.c:2904
          vm_area_dup+0x9c/0x2b8 kernel/fork.c:356
          __split_vma+0xba/0x560 mm/mmap.c:2742
          split_vma+0xca/0x108 mm/mmap.c:2800
          mlock_fixup+0x4ae/0x600 mm/mlock.c:550
          apply_vma_lock_flags+0x2c6/0x398 mm/mlock.c:619
          do_mlock+0x1aa/0x718 mm/mlock.c:711
          __do_sys_mlock2 mm/mlock.c:738 [inline]
          __s390x_sys_mlock2+0x86/0xa8 mm/mlock.c:728
          system_call+0xe0/0x28c arch/s390/kernel/entry.S:415
      
        Freed by task 9333:
          slab_free mm/slub.c:3142 [inline]
          kmem_cache_free+0x7c/0x4b8 mm/slub.c:3158
          __vma_adjust+0x7b2/0x2508 mm/mmap.c:960
          vma_merge+0x87e/0xce0 mm/mmap.c:1209
          userfaultfd_release+0x412/0x6b8 fs/userfaultfd.c:868
          __fput+0x22c/0x7a8 fs/file_table.c:281
          task_work_run+0x200/0x320 kernel/task_work.c:151
          tracehook_notify_resume include/linux/tracehook.h:188 [inline]
          do_notify_resume+0x100/0x148 arch/s390/kernel/signal.c:538
          system_call+0xe6/0x28c arch/s390/kernel/entry.S:416
      
        The buggy address belongs to the object at 00000000962d6948 which belongs to the cache vm_area_struct of size 200
        The buggy address is located 64 bytes inside of 200-byte region [00000000962d6948, 00000000962d6a10)
        The buggy address belongs to the page: page:00000000313a09fe refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x962d6 flags: 0x3ffff00000000200(slab)
        raw: 3ffff00000000200 000040000257e080 0000000c0000000c 000000008020ba00
        raw: 0000000000000000 000f001e00000000 ffffffff00000001 0000000096959501
        page dumped because: kasan: bad access detected
        page->mem_cgroup:0000000096959501
      
        Memory state around the buggy address:
         00000000962d6880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
         00000000962d6900: 00 fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb
        >00000000962d6980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                              ^
         00000000962d6a00: fb fb fc fc fc fc fc fc fc fc 00 00 00 00 00 00
         00000000962d6a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        ==================================================================
      
      Changes for v4.4 stable:
        - Make it apply w/o
          * Commit 4cf58924 ("mm: treewide: remove unused address argument
            from pte_alloc functions")
          * Commit 2b740303 ("mm: Change return type int to vm_fault_t for
            fault handlers")
          * Commit 82b0f8c3 ("mm: join struct fault_env and vm_fault")
          * Commit bae473a4 ("mm: introduce fault_env")
          * Commit 6fcb52a5 ("thp: reduce usage of huge zero page's atomic counter")
      
      Fixes: 6b251fc9 ("userfaultfd: call handle_userfault() for userfaultfd_missing() faults")
      Reported-by: default avatarAlexander Egorenkov <egorenar@linux.ibm.com>
      Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: <stable@vger.kernel.org>	[4.3+]
      Link: https://lkml.kernel.org/r/20201110190329.11920-1-gerald.schaefer@linux.ibm.com
      
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a96661f5
    • Josef Bacik's avatar
      btrfs: cleanup cow block on error · 49fa7c5e
      Josef Bacik authored
      
      commit 572c83ac upstream.
      
      In fstest btrfs/064 a transaction abort in __btrfs_cow_block could lead
      to a system lockup. It gets stuck trying to write back inodes, and the
      write back thread was trying to lock an extent buffer:
      
        $ cat /proc/2143497/stack
        [<0>] __btrfs_tree_lock+0x108/0x250
        [<0>] lock_extent_buffer_for_io+0x35e/0x3a0
        [<0>] btree_write_cache_pages+0x15a/0x3b0
        [<0>] do_writepages+0x28/0xb0
        [<0>] __writeback_single_inode+0x54/0x5c0
        [<0>] writeback_sb_inodes+0x1e8/0x510
        [<0>] wb_writeback+0xcc/0x440
        [<0>] wb_workfn+0xd7/0x650
        [<0>] process_one_work+0x236/0x560
        [<0>] worker_thread+0x55/0x3c0
        [<0>] kthread+0x13a/0x150
        [<0>] ret_from_fork+0x1f/0x30
      
      This is because we got an error while COWing a block, specifically here
      
              if (test_bit(BTRFS_ROOT_SHAREABLE, &root->state)) {
                      ret = btrfs_reloc_cow_block(trans, root, buf, cow);
                      if (ret) {
                              btrfs_abort_transaction(trans, ret);
                              return ret;
                      }
              }
      
        [16402.241552] BTRFS: Transaction aborted (error -2)
        [16402.242362] WARNING: CPU: 1 PID: 2563188 at fs/btrfs/ctree.c:1074 __btrfs_cow_block+0x376/0x540
        [16402.249469] CPU: 1 PID: 2563188 Comm: fsstress Not tainted 5.9.0-rc6+ #8
        [16402.249936] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014
        [16402.250525] RIP: 0010:__btrfs_cow_block+0x376/0x540
        [16402.252417] RSP: 0018:ffff9cca40e578b0 EFLAGS: 00010282
        [16402.252787] RAX: 0000000000000025 RBX: 0000000000000002 RCX: ffff9132bbd19388
        [16402.253278] RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff9132bbd19380
        [16402.254063] RBP: ffff9132b41a49c0 R08: 0000000000000000 R09: 0000000000000000
        [16402.254887] R10: 0000000000000000 R11: ffff91324758b080 R12: ffff91326ef17ce0
        [16402.255694] R13: ffff91325fc0f000 R14: ffff91326ef176b0 R15: ffff9132815e2000
        [16402.256321] FS:  00007f542c6d7b80(0000) GS:ffff9132bbd00000(0000) knlGS:0000000000000000
        [16402.256973] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        [16402.257374] CR2: 00007f127b83f250 CR3: 0000000133480002 CR4: 0000000000370ee0
        [16402.257867] Call Trace:
        [16402.258072]  btrfs_cow_block+0x109/0x230
        [16402.258356]  btrfs_search_slot+0x530/0x9d0
        [16402.258655]  btrfs_lookup_file_extent+0x37/0x40
        [16402.259155]  __btrfs_drop_extents+0x13c/0xd60
        [16402.259628]  ? btrfs_block_rsv_migrate+0x4f/0xb0
        [16402.259949]  btrfs_replace_file_extents+0x190/0x820
        [16402.260873]  btrfs_clone+0x9ae/0xc00
        [16402.261139]  btrfs_extent_same_range+0x66/0x90
        [16402.261771]  btrfs_remap_file_range+0x353/0x3b1
        [16402.262333]  vfs_dedupe_file_range_one.part.0+0xd5/0x140
        [16402.262821]  vfs_dedupe_file_range+0x189/0x220
        [16402.263150]  do_vfs_ioctl+0x552/0x700
        [16402.263662]  __x64_sys_ioctl+0x62/0xb0
        [16402.264023]  do_syscall_64+0x33/0x40
        [16402.264364]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
        [16402.264862] RIP: 0033:0x7f542c7d15cb
        [16402.266901] RSP: 002b:00007ffd35944ea8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        [16402.267627] RAX: ffffffffffffffda RBX: 00000000009d1968 RCX: 00007f542c7d15cb
        [16402.268298] RDX: 00000000009d2490 RSI: 00000000c0189436 RDI: 0000000000000003
        [16402.268958] RBP: 00000000009d2520 R08: 0000000000000036 R09: 00000000009d2e64
        [16402.269726] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002
        [16402.270659] R13: 000000000001f000 R14: 00000000009d1970 R15: 00000000009d2e80
        [16402.271498] irq event stamp: 0
        [16402.271846] hardirqs last  enabled at (0): [<0000000000000000>] 0x0
        [16402.272497] hardirqs last disabled at (0): [<ffffffff910dbf59>] copy_process+0x6b9/0x1ba0
        [16402.273343] softirqs last  enabled at (0): [<ffffffff910dbf59>] copy_process+0x6b9/0x1ba0
        [16402.273905] softirqs last disabled at (0): [<0000000000000000>] 0x0
        [16402.274338] ---[ end trace 737874a5a41a8236 ]---
        [16402.274669] BTRFS: error (device dm-9) in __btrfs_cow_block:1074: errno=-2 No such entry
        [16402.276179] BTRFS info (device dm-9): forced readonly
        [16402.277046] BTRFS: error (device dm-9) in btrfs_replace_file_extents:2723: errno=-2 No such entry
        [16402.278744] BTRFS: error (device dm-9) in __btrfs_cow_block:1074: errno=-2 No such entry
        [16402.279968] BTRFS: error (device dm-9) in __btrfs_cow_block:1074: errno=-2 No such entry
        [16402.280582] BTRFS info (device dm-9): balance: ended with status: -30
      
      The problem here is that as soon as we allocate the new block it is
      locked and marked dirty in the btree inode.  This means that we could
      attempt to writeback this block and need to lock the extent buffer.
      However we're not unlocking it here and thus we deadlock.
      
      Fix this by unlocking the cow block if we have any errors inside of
      __btrfs_cow_block, and also free it so we do not leak it.
      
      CC: stable@vger.kernel.org # 4.4+
      Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      [sudip: use old btrfs_abort_transaction()]
      Signed-off-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      49fa7c5e
    • Steven Rostedt (VMware)'s avatar
      tracing: Fix userstacktrace option for instances · bb8ebd2b
      Steven Rostedt (VMware) authored
      
      commit bcee5278 upstream.
      
      When the instances were able to use their own options, the userstacktrace
      option was left hardcoded for the top level. This made the instance
      userstacktrace option bascially into a nop, and will confuse users that set
      it, but nothing happens (I was confused when it happened to me!)
      
      Cc: stable@vger.kernel.org
      Fixes: 16270145 ("tracing: Add trace options for core options to instances")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bb8ebd2b
    • Peter Ujfalusi's avatar
      spi: bcm2835: Release the DMA channel if probe fails after dma_init · 543327b0
      Peter Ujfalusi authored
      
      [ Upstream commit 666224b4 ]
      
      The DMA channel was not released if either devm_request_irq() or
      devm_spi_register_controller() failed.
      
      Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
      Reviewed-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
      Link: https://lore.kernel.org/r/20191212135550.4634-3-peter.ujfalusi@ti.com
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      [lukas: backport to 4.19-stable]
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      543327b0
    • Lukas Wunner's avatar
      spi: bcm2835: Fix use-after-free on unbind · 0713aa02
      Lukas Wunner authored
      
      [ Upstream commit e1483ac0 ]
      
      bcm2835_spi_remove() accesses the driver's private data after calling
      spi_unregister_controller() even though that function releases the last
      reference on the spi_controller and thereby frees the private data.
      
      Fix by switching over to the new devm_spi_alloc_master() helper which
      keeps the private data accessible until the driver has unbound.
      
      Fixes: f8043872 ("spi: add driver for BCM2835")
      Reported-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
      Reported-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Cc: <stable@vger.kernel.org> # v3.10+: 5e844cc3: spi: Introduce device-managed SPI controller allocation
      Cc: <stable@vger.kernel.org> # v3.10+
      Cc: Vladimir Oltean <olteanv@gmail.com>
      Tested-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/ad66e0a0ad96feb848814842ecf5b6a4539ef35c.1605121038.git.lukas@wunner.de
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0713aa02
    • Lukas Wunner's avatar
      spi: Introduce device-managed SPI controller allocation · a4add022
      Lukas Wunner authored
      
      [ Upstream commit 5e844cc3 ]
      
      SPI driver probing currently comprises two steps, whereas removal
      comprises only one step:
      
          spi_alloc_master()
          spi_register_master()
      
          spi_unregister_master()
      
      That's because spi_unregister_master() calls device_unregister()
      instead of device_del(), thereby releasing the reference on the
      spi_master which was obtained by spi_alloc_master().
      
      An SPI driver's private data is contained in the same memory allocation
      as the spi_master struct.  Thus, once spi_unregister_master() has been
      called, the private data is inaccessible.  But some drivers need to
      access it after spi_unregister_master() to perform further teardown
      steps.
      
      Introduce devm_spi_alloc_master(), which releases a reference on the
      spi_master struct only after the driver has unbound, thereby keeping the
      memory allocation accessible.  Change spi_unregister_master() to not
      release a reference if the spi_master was allocated by the new devm
      function.
      
      The present commit is small enough to be backportable to stable.
      It allows fixing drivers which use the private data in their ->remove()
      hook after it's been freed.  It also allows fixing drivers which neglect
      to release a reference on the spi_master in the probe error path.
      
      Long-term, most SPI drivers shall be moved over to the devm function
      introduced herein.  The few that can't shall be changed in a treewide
      commit to explicitly release the last reference on the master.
      That commit shall amend spi_unregister_master() to no longer release
      a reference, thereby completing the migration.
      
      As a result, the behaviour will be less surprising and more consistent
      with subsystems such as IIO, which also includes the private data in the
      allocation of the generic iio_dev struct, but calls device_del() in
      iio_device_unregister().
      
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Link: https://lore.kernel.org/r/272bae2ef08abd21388c98e23729886663d19192.1605121038.git.lukas@wunner.de
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a4add022
    • Suravee Suthikulpanit's avatar
      iommu/amd: Set DTE[IntTabLen] to represent 512 IRTEs · a1ddeecd
      Suravee Suthikulpanit authored
      
      commit 4165bf01 upstream.
      
      According to the AMD IOMMU spec, the commit 73db2fc5
      ("iommu/amd: Increase interrupt remapping table limit to 512 entries")
      also requires the interrupt table length (IntTabLen) to be set to 9
      (power of 2) in the device table mapping entry (DTE).
      
      Fixes: 73db2fc5 ("iommu/amd: Increase interrupt remapping table limit to 512 entries")
      Reported-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
      Signed-off-by: default avatarSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
      Reviewed-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
      Link: https://lore.kernel.org/r/20201207091920.3052-1-suravee.suthikulpanit@amd.com
      
      
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a1ddeecd
    • Ard Biesheuvel's avatar
      arm64: assembler: make adr_l work in modules under KASLR · 51a5438c
      Ard Biesheuvel authored
      
      commit 41c066f2 upstream
      
      When CONFIG_RANDOMIZE_MODULE_REGION_FULL=y, the offset between loaded
      modules and the core kernel may exceed 4 GB, putting symbols exported
      by the core kernel out of the reach of the ordinary adrp/add instruction
      pairs used to generate relative symbol references. So make the adr_l
      macro emit a movz/movk sequence instead when executing in module context.
      
      While at it, remove the pointless special case for the stack pointer.
      
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      [ dannf: backported to v4.4 by replacing the 3-arg adr_l macro in head.S
        with it's output, as this commit drops the 3-arg variant ]
      Fixes: c042dd60 ("crypto: arm64/sha - avoid non-standard inline asm tricks")
      Signed-off-by: default avatardann frazier <dann.frazier@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      51a5438c
    • Christian Eggers's avatar
      i2c: imx: Check for I2SR_IAL after every byte · 735f3adc
      Christian Eggers authored
      
      commit 1de67a3d upstream.
      
      Arbitration Lost (IAL) can happen after every single byte transfer. If
      arbitration is lost, the I2C hardware will autonomously switch from
      master mode to slave. If a transfer is not aborted in this state,
      consecutive transfers will not be executed by the hardware and will
      timeout.
      
      Signed-off-by: default avatarChristian Eggers <ceggers@arri.de>
      Tested (not extensively) on Vybrid VF500 (Toradex VF50):
      Tested-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Acked-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      735f3adc
    • Christian Eggers's avatar
      i2c: imx: Fix reset of I2SR_IAL flag · f8927031
      Christian Eggers authored
      
      commit 384a9565 upstream.
      
      According to the "VFxxx Controller Reference Manual" (and the comment
      block starting at line 97), Vybrid requires writing a one for clearing
      an interrupt flag. Syncing the method for clearing I2SR_IIF in
      i2c_imx_isr().
      
      Signed-off-by: default avatarChristian Eggers <ceggers@arri.de>
      Fixes: 4b775022 ("i2c: imx: add struct to hold more configurable quirks")
      Reviewed-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Acked-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8927031
    • Paulo Alcantara's avatar
      cifs: fix potential use-after-free in cifs_echo_request() · 87a3af64
      Paulo Alcantara authored
      
      commit 21225336 upstream.
      
      This patch fixes a potential use-after-free bug in
      cifs_echo_request().
      
      For instance,
      
        thread 1
        --------
        cifs_demultiplex_thread()
          clean_demultiplex_info()
            kfree(server)
      
        thread 2 (workqueue)
        --------
        apic_timer_interrupt()
          smp_apic_timer_interrupt()
            irq_exit()
              __do_softirq()
                run_timer_softirq()
                  call_timer_fn()
      	      cifs_echo_request() <- use-after-free in server ptr
      
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
      CC: Stable <stable@vger.kernel.org>
      Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      87a3af64
    • Jann Horn's avatar
      tty: Fix ->session locking · 7b4a4b94
      Jann Horn authored
      
      commit c8bcd9c5 upstream.
      
      Currently, locking of ->session is very inconsistent; most places
      protect it using the legacy tty mutex, but disassociate_ctty(),
      __do_SAK(), tiocspgrp() and tiocgsid() don't.
      Two of the writers hold the ctrl_lock (because they already need it for
      ->pgrp), but __proc_set_tty() doesn't do that yet.
      
      On a PREEMPT=y system, an unprivileged user can theoretically abuse
      this broken locking to read 4 bytes of freed memory via TIOCGSID if
      tiocgsid() is preempted long enough at the right point. (Other things
      might also go wrong, especially if root-only ioctls are involved; I'm
      not sure about that.)
      
      Change the locking on ->session such that:
      
       - tty_lock() is held by all writers: By making disassociate_ctty()
         hold it. This should be fine because the same lock can already be
         taken through the call to tty_vhangup_session().
         The tricky part is that we need to shorten the area covered by
         siglock to be able to take tty_lock() without ugly retry logic; as
         far as I can tell, this should be fine, since nothing in the
         signal_struct is touched in the `if (tty)` branch.
       - ctrl_lock is held by all writers: By changing __proc_set_tty() to
         hold the lock a little longer.
       - All readers that aren't holding tty_lock() hold ctrl_lock: By
         adding locking to tiocgsid() and __do_SAK(), and expanding the area
         covered by ctrl_lock in tiocspgrp().
      
      Cc: stable@kernel.org
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Reviewed-by: default avatarJiri Slaby <jirislaby@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7b4a4b94
    • Takashi Iwai's avatar
      ALSA: hda/generic: Add option to enforce preferred_dacs pairs · 23f5ce6b
      Takashi Iwai authored
      commit 242d990c upstream.
      
      The generic parser accepts the preferred_dacs[] pairs as a hint for
      assigning a DAC to each pin, but this hint doesn't work always
      effectively.  Currently it's merely a secondary choice after the trial
      with the path index failed.  This made sometimes it difficult to
      assign DACs without mimicking the connection list and/or the badness
      table.
      
      This patch adds a new flag, obey_preferred_dacs, that changes the
      behavior of the parser.  As its name stands, the parser obeys the
      given preferred_dacs[] pairs by skipping the path index matching and
      giving a high penalty if no DAC is assigned by the pairs.  This mode
      will help for assigning the fixed DACs forcibly from the codec
      driver.
      
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20201127141104.11041-1-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      23f5ce6b
    • Kailang Yang's avatar
      ALSA: hda/realtek - Add new codec supported for ALC897 · 90635608
      Kailang Yang authored
      
      commit e5782a5d upstream.
      
      Enable new codec supported for ALC897.
      
      Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/3b00520f304842aab8291eb8d9191bd8@realtek.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      90635608
    • Jann Horn's avatar
      tty: Fix ->pgrp locking in tiocspgrp() · 30f77526
      Jann Horn authored
      
      commit 54ffccbf upstream.
      
      tiocspgrp() takes two tty_struct pointers: One to the tty that userspace
      passed to ioctl() (`tty`) and one to the TTY being changed (`real_tty`).
      These pointers are different when ioctl() is called with a master fd.
      
      To properly lock real_tty->pgrp, we must take real_tty->ctrl_lock.
      
      This bug makes it possible for racing ioctl(TIOCSPGRP, ...) calls on
      both sides of a PTY pair to corrupt the refcount of `struct pid`,
      leading to use-after-free errors.
      
      Fixes: 47f86834 ("redo locking of tty->pgrp")
      CC: stable@kernel.org
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Reviewed-by: default avatarJiri Slaby <jirislaby@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      30f77526
    • Giacinto Cifelli's avatar
      USB: serial: option: add support for Thales Cinterion EXS82 · 6b2bd162
      Giacinto Cifelli authored
      
      commit 6d6556c0 upstream.
      
      There is a single option port in this modem, and it is used as debug port.
      
      lsusb -v for this device:
      
      Bus 001 Device 002: ID 1e2d:006c
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass          239 Miscellaneous Device
        bDeviceSubClass         2 ?
        bDeviceProtocol         1 Interface Association
        bMaxPacketSize0        64
        idVendor           0x1e2d
        idProduct          0x006c
        bcdDevice            0.00
        iManufacturer           4
        iProduct                3
        iSerial                 5
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength          243
          bNumInterfaces          7
          bConfigurationValue     1
          iConfiguration          2
          bmAttributes         0xe0
            Self Powered
            Remote Wakeup
          MaxPower              500mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass    255 Vendor Specific Subclass
            bInterfaceProtocol    255 Vendor Specific Protocol
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x81  EP 1 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x01  EP 1 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
          Interface Association:
            bLength                 8
            bDescriptorType        11
            bFirstInterface         1
            bInterfaceCount         2
            bFunctionClass          2 Communications
            bFunctionSubClass       2 Abstract (modem)
            bFunctionProtocol       1 AT-commands (v.25ter)
            iFunction               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      2 Abstract (modem)
            bInterfaceProtocol      1 AT-commands (v.25ter)
            iInterface              0
            CDC Header:
              bcdCDC               1.10
            CDC ACM:
              bmCapabilities       0x02
                line coding and serial state
            CDC Call Management:
              bmCapabilities       0x03
                call management
                use DataInterface
              bDataInterface          2
            CDC Union:
              bMasterInterface        1
              bSlaveInterface         2
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x82  EP 2 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               5
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        2
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0 Unused
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x83  EP 3 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x02  EP 2 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
          Interface Association:
            bLength                 8
            bDescriptorType        11
            bFirstInterface         3
            bInterfaceCount         2
            bFunctionClass          2 Communications
            bFunctionSubClass       2 Abstract (modem)
            bFunctionProtocol       1 AT-commands (v.25ter)
            iFunction               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        3
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      2 Abstract (modem)
            bInterfaceProtocol      1 AT-commands (v.25ter)
            iInterface              0
            CDC Header:
              bcdCDC               1.10
            CDC ACM:
              bmCapabilities       0x02
                line coding and serial state
            CDC Call Management:
              bmCapabilities       0x03
                call management
                use DataInterface
              bDataInterface          4
            CDC Union:
              bMasterInterface        3
              bSlaveInterface         4
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x84  EP 4 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               5
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        4
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0 Unused
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x85  EP 5 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x03  EP 3 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
          Interface Association:
            bLength                 8
            bDescriptorType        11
            bFirstInterface         5
            bInterfaceCount         2
            bFunctionClass          2 Communications
            bFunctionSubClass       2 Abstract (modem)
            bFunctionProtocol       1 AT-commands (v.25ter)
            iFunction               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        5
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      6 Ethernet Networking
            bInterfaceProtocol      0
            iInterface              0
            CDC Header:
              bcdCDC               1.10
            CDC Ethernet:
              iMacAddress                      1 (??)
              bmEthernetStatistics    0x00000000
              wMaxSegmentSize              16384
              wNumberMCFilters            0x0001
              bNumberPowerFilters              0
            CDC Union:
              bMasterInterface        5
              bSlaveInterface         6
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x86  EP 6 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               5
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        6
            bAlternateSetting       0
            bNumEndpoints           0
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0 Unused
            bInterfaceProtocol      0
            iInterface              0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        6
            bAlternateSetting       1
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0 Unused
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x87  EP 7 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x04  EP 4 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
      
      Signed-off-by: default avatarGiacinto Cifelli <gciofono@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6b2bd162
    • Vincent Palatin's avatar
      USB: serial: option: add Fibocom NL668 variants · 5ea50c67
      Vincent Palatin authored
      
      commit 5e4d659b upstream.
      
      Update the USB serial option driver support for the Fibocom NL668 Cat.4
      LTE modules as there are actually several different variants.
      Got clarifications from Fibocom, there are distinct products:
      - VID:PID 1508:1001, NL668 for IOT (no MBIM interface)
      - VID:PID 2cb7:01a0, NL668-AM and NL652-EU are laptop M.2 cards (with
        MBIM interfaces for Windows/Linux/Chrome OS), respectively for Americas
        and Europe.
      
      usb-devices output for the laptop M.2 cards:
      T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=480 MxCh= 0
      D:  Ver= 2.00 Cls=ef(misc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2cb7 ProdID=01a0 Rev=03.18
      S:  Manufacturer=Fibocom Wireless Inc.
      S:  Product=Fibocom NL652-EU Modem
      S:  SerialNumber=0123456789ABCDEF
      C:  #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      
      Signed-off-by: default avatarVincent Palatin <vpalatin@chromium.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ea50c67
    • Johan Hovold's avatar
      USB: serial: ch341: sort device-id entries · 9931011d
      Johan Hovold authored
      
      commit bf193bfc upstream.
      
      Keep the device-id entries sorted to make it easier to add new ones in
      the right spot.
      
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9931011d
    • Jan-Niklas Burfeind's avatar
      USB: serial: ch341: add new Product ID for CH341A · 6faea618
      Jan-Niklas Burfeind authored
      commit 46ee4abb upstream.
      
      Add PID for CH340 that's found on a ch341 based Programmer made by keeyees.
      The specific device that contains the serial converter is described
      here: http://www.keeyees.com/a/Products/ej/36.html
      
      
      
      The driver works flawlessly as soon as the new PID (0x5512) is added to
      it.
      
      Signed-off-by: default avatarJan-Niklas Burfeind <kernel@aiyionpri.me>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6faea618
    • Johan Hovold's avatar
      USB: serial: kl5kusb105: fix memleak on open · 6f27b693
      Johan Hovold authored
      
      commit 3f203f05 upstream.
      
      Fix memory leak of control-message transfer buffer on successful open().
      
      Fixes: 6774d5f5 ("USB: serial: kl5kusb105: fix open error path")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f27b693
    • Vamsi Krishna Samavedam's avatar
      usb: gadget: f_fs: Use local copy of descriptors for userspace copy · b0e4a1bc
      Vamsi Krishna Samavedam authored
      
      commit a4b98a75 upstream.
      
      The function may be unbound causing the ffs_ep and its descriptors
      to be freed while userspace is in the middle of an ioctl requesting
      the same descriptors. Avoid dangling pointer reference by first
      making a local copy of desctiptors before releasing the spinlock.
      
      Fixes: c559a353 ("usb: gadget: f_fs: add ioctl returning ep descriptor")
      Reviewed-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarVamsi Krishna Samavedam <vskrishn@codeaurora.org>
      Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20201130203453.28154-1-jackp@codeaurora.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b0e4a1bc
    • Toke Høiland-Jørgensen's avatar
      vlan: consolidate VLAN parsing code and limit max parsing depth · bb7b2627
      Toke Høiland-Jørgensen authored
      
      [ Upstream commit 469acedd ]
      
      Toshiaki pointed out that we now have two very similar functions to extract
      the L3 protocol number in the presence of VLAN tags. And Daniel pointed out
      that the unbounded parsing loop makes it possible for maliciously crafted
      packets to loop through potentially hundreds of tags.
      
      Fix both of these issues by consolidating the two parsing functions and
      limiting the VLAN tag parsing to a max depth of 8 tags. As part of this,
      switch over __vlan_get_protocol() to use skb_header_pointer() instead of
      pskb_may_pull(), to avoid the possible side effects of the latter and keep
      the skb pointer 'const' through all the parsing functions.
      
      v2:
      - Use limit of 8 tags instead of 32 (matching XMIT_RECURSION_LIMIT)
      
      Reported-by: default avatarToshiaki Makita <toshiaki.makita1@gmail.com>
      Reported-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Fixes: d7bf2ebe ("sched: consistently handle layer3 header accesses in the presence of VLANs")
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bb7b2627
    • Josef Bacik's avatar
      btrfs: sysfs: init devices outside of the chunk_mutex · 22e3c084
      Josef Bacik authored
      
      commit ca10845a upstream
      
      While running btrfs/061, btrfs/073, btrfs/078, or btrfs/178 we hit the
      following lockdep splat:
      
        ======================================================
        WARNING: possible circular locking dependency detected
        5.9.0-rc3+ #4 Not tainted
        ------------------------------------------------------
        kswapd0/100 is trying to acquire lock:
        ffff96ecc22ef4a0 (&delayed_node->mutex){+.+.}-{3:3}, at: __btrfs_release_delayed_node.part.0+0x3f/0x330
      
        but task is already holding lock:
        ffffffff8dd74700 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x5/0x30
      
        which lock already depends on the new lock.
      
        the existing dependency chain (in reverse order) is:
      
        -> #3 (fs_reclaim){+.+.}-{0:0}:
      	 fs_reclaim_acquire+0x65/0x80
      	 slab_pre_alloc_hook.constprop.0+0x20/0x200
      	 kmem_cache_alloc+0x37/0x270
      	 alloc_inode+0x82/0xb0
      	 iget_locked+0x10d/0x2c0
      	 kernfs_get_inode+0x1b/0x130
      	 kernfs_get_tree+0x136/0x240
      	 sysfs_get_tree+0x16/0x40
      	 vfs_get_tree+0x28/0xc0
      	 path_mount+0x434/0xc00
      	 __x64_sys_mount+0xe3/0x120
      	 do_syscall_64+0x33/0x40
      	 entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
        -> #2 (kernfs_mutex){+.+.}-{3:3}:
      	 __mutex_lock+0x7e/0x7e0
      	 kernfs_add_one+0x23/0x150
      	 kernfs_create_link+0x63/0xa0
      	 sysfs_do_create_link_sd+0x5e/0xd0
      	 btrfs_sysfs_add_devices_dir+0x81/0x130
      	 btrfs_init_new_device+0x67f/0x1250
      	 btrfs_ioctl+0x1ef/0x2e20
      	 __x64_sys_ioctl+0x83/0xb0
      	 do_syscall_64+0x33/0x40
      	 entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
        -> #1 (&fs_info->chunk_mutex){+.+.}-{3:3}:
      	 __mutex_lock+0x7e/0x7e0
      	 btrfs_chunk_alloc+0x125/0x3a0
      	 find_free_extent+0xdf6/0x1210
      	 btrfs_reserve_extent+0xb3/0x1b0
      	 btrfs_alloc_tree_block+0xb0/0x310
      	 alloc_tree_block_no_bg_flush+0x4a/0x60
      	 __btrfs_cow_block+0x11a/0x530
      	 btrfs_cow_block+0x104/0x220
      	 btrfs_search_slot+0x52e/0x9d0
      	 btrfs_insert_empty_items+0x64/0xb0
      	 btrfs_insert_delayed_items+0x90/0x4f0
      	 btrfs_commit_inode_delayed_items+0x93/0x140
      	 btrfs_log_inode+0x5de/0x2020
      	 btrfs_log_inode_parent+0x429/0xc90
      	 btrfs_log_new_name+0x95/0x9b
      	 btrfs_rename2+0xbb9/0x1800
      	 vfs_rename+0x64f/0x9f0
      	 do_renameat2+0x320/0x4e0
      	 __x64_sys_rename+0x1f/0x30
      	 do_syscall_64+0x33/0x40
      	 entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
        -> #0 (&delayed_node->mutex){+.+.}-{3:3}:
      	 __lock_acquire+0x119c/0x1fc0
      	 lock_acquire+0xa7/0x3d0
      	 __mutex_lock+0x7e/0x7e0
      	 __btrfs_release_delayed_node.part.0+0x3f/0x330
      	 btrfs_evict_inode+0x24c/0x500
      	 evict+0xcf/0x1f0
      	 dispose_list+0x48/0x70
      	 prune_icache_sb+0x44/0x50
      	 super_cache_scan+0x161/0x1e0
      	 do_shrink_slab+0x178/0x3c0
      	 shrink_slab+0x17c/0x290
      	 shrink_node+0x2b2/0x6d0
      	 balance_pgdat+0x30a/0x670
      	 kswapd+0x213/0x4c0
      	 kthread+0x138/0x160
      	 ret_from_fork+0x1f/0x30
      
        other info that might help us debug this:
      
        Chain exists of:
          &delayed_node->mutex --> kernfs_mutex --> fs_reclaim
      
         Possible unsafe locking scenario:
      
      	 CPU0                    CPU1
      	 ----                    ----
          lock(fs_reclaim);
      				 lock(kernfs_mutex);
      				 lock(fs_reclaim);
          lock(&delayed_node->mutex);
      
         *** DEADLOCK ***
      
        3 locks held by kswapd0/100:
         #0: ffffffff8dd74700 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x5/0x30
         #1: ffffffff8dd65c50 (shrinker_rwsem){++++}-{3:3}, at: shrink_slab+0x115/0x290
         #2: ffff96ed2ade30e0 (&type->s_umount_key#36){++++}-{3:3}, at: super_cache_scan+0x38/0x1e0
      
        stack backtrace:
        CPU: 0 PID: 100 Comm: kswapd0 Not tainted 5.9.0-rc3+ #4
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014
        Call Trace:
         dump_stack+0x8b/0xb8
         check_noncircular+0x12d/0x150
         __lock_acquire+0x119c/0x1fc0
         lock_acquire+0xa7/0x3d0
         ? __btrfs_release_delayed_node.part.0+0x3f/0x330
         __mutex_lock+0x7e/0x7e0
         ? __btrfs_release_delayed_node.part.0+0x3f/0x330
         ? __btrfs_release_delayed_node.part.0+0x3f/0x330
         ? lock_acquire+0xa7/0x3d0
         ? find_held_lock+0x2b/0x80
         __btrfs_release_delayed_node.part.0+0x3f/0x330
         btrfs_evict_inode+0x24c/0x500
         evict+0xcf/0x1f0
         dispose_list+0x48/0x70
         prune_icache_sb+0x44/0x50
         super_cache_scan+0x161/0x1e0
         do_shrink_slab+0x178/0x3c0
         shrink_slab+0x17c/0x290
         shrink_node+0x2b2/0x6d0
         balance_pgdat+0x30a/0x670
         kswapd+0x213/0x4c0
         ? _raw_spin_unlock_irqrestore+0x41/0x50
         ? add_wait_queue_exclusive+0x70/0x70
         ? balance_pgdat+0x670/0x670
         kthread+0x138/0x160
         ? kthread_create_worker_on_cpu+0x40/0x40
         ret_from_fork+0x1f/0x30
      
      This happens because we are holding the chunk_mutex at the time of
      adding in a new device.  However we only need to hold the
      device_list_mutex, as we're going to iterate over the fs_devices
      devices.  Move the sysfs init stuff outside of the chunk_mutex to get
      rid of this lockdep splat.
      
      CC: stable@vger.kernel.org # 4.4.x: f3cd2c58: btrfs: sysfs, rename device_link add/remove functions
      CC: stable@vger.kernel.org # 4.4.x
      Reported-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      [sudip: adjust context]
      Signed-off-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      22e3c084
    • Michal Suchanek's avatar
      powerpc: Stop exporting __clear_user which is now inlined. · d8a0e677
      Michal Suchanek authored
      
      Stable commit 452e2a83 ("powerpc: Fix __clear_user() with KUAP
      enabled") redefines __clear_user as inline function but does not remove
      the export.
      
      Fixes: 452e2a83 ("powerpc: Fix __clear_user() with KUAP enabled")
      
      Signed-off-by: default avatarMichal Suchanek <msuchanek@suse.de>
      Acked-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      d8a0e677
    • Po-Hsu Lin's avatar
      Input: i8042 - add ByteSpeed touchpad to noloop table · c133f3e2
      Po-Hsu Lin authored
      commit a48491c6 upstream.
      
      It looks like the C15B laptop got another vendor: ByteSpeed LLC.
      
      Avoid AUX loopback on this touchpad as well, thus input subsystem will
      be able to recognize a Synaptics touchpad in the AUX port.
      
      BugLink: https://bugs.launchpad.net/bugs/1906128
      
      
      Signed-off-by: default avatarPo-Hsu Lin <po-hsu.lin@canonical.com>
      Link: https://lore.kernel.org/r/20201201054723.5939-1-po-hsu.lin@canonical.com
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c133f3e2
    • Sanjay Govind's avatar
      Input: xpad - support Ardwiino Controllers · d8a4f268
      Sanjay Govind authored
      
      commit 2aab1561 upstream.
      
      This commit adds support for Ardwiino Controllers
      
      Signed-off-by: default avatarSanjay Govind <sanjay.govind9@gmail.com>
      Link: https://lore.kernel.org/r/20201201071922.131666-1-sanjay.govind9@gmail.com
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d8a4f268
    • Krzysztof Kozlowski's avatar
      dt-bindings: net: correct interrupt flags in examples · 6d1f5de7
      Krzysztof Kozlowski authored
      
      [ Upstream commit 4d521943 ]
      
      GPIO_ACTIVE_x flags are not correct in the context of interrupt flags.
      These are simple defines so they could be used in DTS but they will not
      have the same meaning:
      1. GPIO_ACTIVE_HIGH = 0 = IRQ_TYPE_NONE
      2. GPIO_ACTIVE_LOW  = 1 = IRQ_TYPE_EDGE_RISING
      
      Correct the interrupt flags, assuming the author of the code wanted same
      logical behavior behind the name "ACTIVE_xxx", this is:
        ACTIVE_LOW  => IRQ_TYPE_LEVEL_LOW
        ACTIVE_HIGH => IRQ_TYPE_LEVEL_HIGH
      
      Fixes: a1a8b459 ("NFC: pn544: i2c: Add DTS Documentation")
      Fixes: 6be88670 ("NFC: nxp-nci_i2c: Add I2C support to NXP NCI driver")
      Fixes: e3b32922 ("dt-bindings: can: tcan4x5x: Update binding to use interrupt property")
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> # for tcan4x5x.txt
      Link: https://lore.kernel.org/r/20201026153620.89268-1-krzk@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6d1f5de7
    • Zhang Changzhong's avatar
      net: pasemi: fix error return code in pasemi_mac_open() · 712d1399
      Zhang Changzhong authored
      
      [ Upstream commit aba84871 ]
      
      Fix to return a negative error code from the error handling
      case instead of 0, as done elsewhere in this function.
      
      Fixes: 72b05b99 ("pasemi_mac: RX/TX ring management cleanup")
      Fixes: 8d636d8b ("pasemi_mac: jumbo frame support")
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
      Link: https://lore.kernel.org/r/1606903035-1838-1-git-send-email-zhangchangzhong@huawei.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      712d1399
    • Zhang Changzhong's avatar
      cxgb3: fix error return code in t3_sge_alloc_qset() · 31d57548
      Zhang Changzhong authored
      
      [ Upstream commit ff992489 ]
      
      Fix to return a negative error code from the error handling
      case instead of 0, as done elsewhere in this function.
      
      Fixes: b1fb1f28 ("cxgb3 - Fix dma mapping error path")
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
      Acked-by: default avatarRaju Rangoju <rajur@chelsio.com>
      Link: https://lore.kernel.org/r/1606902965-1646-1-git-send-email-zhangchangzhong@huawei.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      31d57548
    • Dan Carpenter's avatar
      net/x25: prevent a couple of overflows · 3cb72fe7
      Dan Carpenter authored
      
      [ Upstream commit 6ee50c8e ]
      
      The .x25_addr[] address comes from the user and is not necessarily
      NUL terminated.  This leads to a couple problems.  The first problem is
      that the strlen() in x25_bind() can read beyond the end of the buffer.
      
      The second problem is more subtle and could result in memory corruption.
      The call tree is:
        x25_connect()
        --> x25_write_internal()
            --> x25_addr_aton()
      
      The .x25_addr[] buffers are copied to the "addresses" buffer from
      x25_write_internal() so it will lead to stack corruption.
      
      Verify that the strings are NUL terminated and return -EINVAL if they
      are not.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Fixes: a9288525 ("X25: Dont let x25_bind use addresses containing characters")
      Reported-by: default avatar"kiyin(尹亮)" <kiyin@tencent.com>
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarMartin Schiller <ms@dev.tdt.de>
      Link: https://lore.kernel.org/r/X8ZeAKm8FnFpN//B@mwanda
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3cb72fe7
    • Antoine Tenart's avatar
      netfilter: bridge: reset skb->pkt_type after NF_INET_POST_ROUTING traversal · 7dfa4e52
      Antoine Tenart authored
      
      [ Upstream commit 44f64f23 ]
      
      Netfilter changes PACKET_OTHERHOST to PACKET_HOST before invoking the
      hooks as, while it's an expected value for a bridge, routing expects
      PACKET_HOST. The change is undone later on after hook traversal. This
      can be seen with pairs of functions updating skb>pkt_type and then
      reverting it to its original value:
      
      For hook NF_INET_PRE_ROUTING:
        setup_pre_routing / br_nf_pre_routing_finish
      
      For hook NF_INET_FORWARD:
        br_nf_forward_ip / br_nf_forward_finish
      
      But the third case where netfilter does this, for hook
      NF_INET_POST_ROUTING, the packet type is changed in br_nf_post_routing
      but never reverted. A comment says:
      
        /* We assume any code from br_dev_queue_push_xmit onwards doesn't care
         * about the value of skb->pkt_type. */
      
      But when having a tunnel (say vxlan) attached to a bridge we have the
      following call trace:
      
        br_nf_pre_routing
        br_nf_pre_routing_ipv6
           br_nf_pre_routing_finish
        br_nf_forward_ip
           br_nf_forward_finish
        br_nf_post_routing           <- pkt_type is updated to PACKET_HOST
           br_nf_dev_queue_xmit      <- but not reverted to its original value
        vxlan_xmit
           vxlan_xmit_one
              skb_tunnel_check_pmtu  <- a check on pkt_type is performed
      
      In this specific case, this creates issues such as when an ICMPv6 PTB
      should be sent back. When CONFIG_BRIDGE_NETFILTER is enabled, the PTB
      isn't sent (as skb_tunnel_check_pmtu checks if pkt_type is PACKET_HOST
      and returns early).
      
      If the comment is right and no one cares about the value of
      skb->pkt_type after br_dev_queue_push_xmit (which isn't true), resetting
      it to its original value should be safe.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarFlorian Westphal <fw@strlen.de>
      Link: https://lore.kernel.org/r/20201123174902.622102-1-atenart@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7dfa4e52
    • Jamie Iles's avatar
      bonding: wait for sysfs kobject destruction before freeing struct slave · ecfcf319
      Jamie Iles authored
      
      [ Upstream commit b9ad3e9f ]
      
      syzkaller found that with CONFIG_DEBUG_KOBJECT_RELEASE=y, releasing a
      struct slave device could result in the following splat:
      
        kobject: 'bonding_slave' (00000000cecdd4fe): kobject_release, parent 0000000074ceb2b2 (delayed 1000)
        bond0 (unregistering): (slave bond_slave_1): Releasing backup interface
        ------------[ cut here ]------------
        ODEBUG: free active (active state 0) object type: timer_list hint: workqueue_select_cpu_near kernel/workqueue.c:1549 [inline]
        ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x98 kernel/workqueue.c:1600
        WARNING: CPU: 1 PID: 842 at lib/debugobjects.c:485 debug_print_object+0x180/0x240 lib/debugobjects.c:485
        Kernel panic - not syncing: panic_on_warn set ...
        CPU: 1 PID: 842 Comm: kworker/u4:4 Tainted: G S                5.9.0-rc8+ #96
        Hardware name: linux,dummy-virt (DT)
        Workqueue: netns cleanup_net
        Call trace:
         dump_backtrace+0x0/0x4d8 include/linux/bitmap.h:239
         show_stack+0x34/0x48 arch/arm64/kernel/traps.c:142
         __dump_stack lib/dump_stack.c:77 [inline]
         dump_stack+0x174/0x1f8 lib/dump_stack.c:118
         panic+0x360/0x7a0 kernel/panic.c:231
         __warn+0x244/0x2ec kernel/panic.c:600
         report_bug+0x240/0x398 lib/bug.c:198
         bug_handler+0x50/0xc0 arch/arm64/kernel/traps.c:974
         call_break_hook+0x160/0x1d8 arch/arm64/kernel/debug-monitors.c:322
         brk_handler+0x30/0xc0 arch/arm64/kernel/debug-monitors.c:329
         do_debug_exception+0x184/0x340 arch/arm64/mm/fault.c:864
         el1_dbg+0x48/0xb0 arch/arm64/kernel/entry-common.c:65
         el1_sync_handler+0x170/0x1c8 arch/arm64/kernel/entry-common.c:93
         el1_sync+0x80/0x100 arch/arm64/kernel/entry.S:594
         debug_print_object+0x180/0x240 lib/debugobjects.c:485
         __debug_check_no_obj_freed lib/debugobjects.c:967 [inline]
         debug_check_no_obj_freed+0x200/0x430 lib/debugobjects.c:998
         slab_free_hook mm/slub.c:1536 [inline]
         slab_free_freelist_hook+0x190/0x210 mm/slub.c:1577
         slab_free mm/slub.c:3138 [inline]
         kfree+0x13c/0x460 mm/slub.c:4119
         bond_free_slave+0x8c/0xf8 drivers/net/bonding/bond_main.c:1492
         __bond_release_one+0xe0c/0xec8 drivers/net/bonding/bond_main.c:2190
         bond_slave_netdev_event drivers/net/bonding/bond_main.c:3309 [inline]
         bond_netdev_event+0x8f0/0xa70 drivers/net/bonding/bond_main.c:3420
         notifier_call_chain+0xf0/0x200 kernel/notifier.c:83
         __raw_notifier_call_chain kernel/notifier.c:361 [inline]
         raw_notifier_call_chain+0x44/0x58 kernel/notifier.c:368
         call_netdevice_notifiers_info+0xbc/0x150 net/core/dev.c:2033
         call_netdevice_notifiers_extack net/core/dev.c:2045 [inline]
         call_netdevice_notifiers net/core/dev.c:2059 [inline]
         rollback_registered_many+0x6a4/0xec0 net/core/dev.c:9347
         unregister_netdevice_many.part.0+0x2c/0x1c0 net/core/dev.c:10509
         unregister_netdevice_many net/core/dev.c:10508 [inline]
         default_device_exit_batch+0x294/0x338 net/core/dev.c:10992
         ops_exit_list.isra.0+0xec/0x150 net/core/net_namespace.c:189
         cleanup_net+0x44c/0x888 net/core/net_namespace.c:603
         process_one_work+0x96c/0x18c0 kernel/workqueue.c:2269
         worker_thread+0x3f0/0xc30 kernel/workqueue.c:2415
         kthread+0x390/0x498 kernel/kthread.c:292
         ret_from_fork+0x10/0x18 arch/arm64/kernel/entry.S:925
      
      This is a potential use-after-free if the sysfs nodes are being accessed
      whilst removing the struct slave, so wait for the object destruction to
      complete before freeing the struct slave itself.
      
      Fixes: 07699f9a ("bonding: add sysfs /slave dir for bond slave devices.")
      Fixes: a068aab4 ("bonding: Fix reference count leak in bond_sysfs_slave_add.")
      Cc: Qiushi Wu <wu000273@umn.edu>
      Cc: Jay Vosburgh <j.vosburgh@gmail.com>
      Cc: Veaceslav Falico <vfalico@gmail.com>
      Cc: Andy Gospodarek <andy@greyhouse.net>
      Signed-off-by: default avatarJamie Iles <jamie@nuviainc.com>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Link: https://lore.kernel.org/r/20201120142827.879226-1-jamie@nuviainc.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ecfcf319
    • Yves-Alexis Perez's avatar
      usbnet: ipheth: fix connectivity with iOS 14 · ed73a61b
      Yves-Alexis Perez authored
      
      [ Upstream commit f33d9e2b ]
      
      Starting with iOS 14 released in September 2020, connectivity using the
      personal hotspot USB tethering function of iOS devices is broken.
      
      Communication between the host and the device (for example ICMP traffic
      or DNS resolution using the DNS service running in the device itself)
      works fine, but communication to endpoints further away doesn't work.
      
      Investigation on the matter shows that no UDP and ICMP traffic from the
      tethered host is reaching the Internet at all. For TCP traffic there are
      exchanges between tethered host and server but packets are modified in
      transit leading to impossible communication.
      
      After some trials Matti Vuorela discovered that reducing the URB buffer
      size by two bytes restored the previous behavior. While a better
      solution might exist to fix the issue, since the protocol is not
      publicly documented and considering the small size of the fix, let's do
      that.
      
      Tested-by: default avatarMatti Vuorela <matti.vuorela@bitfactor.fi>
      Signed-off-by: default avatarYves-Alexis Perez <corsac@corsac.net>
      Link: https://lore.kernel.org/linux-usb/CAAn0qaXmysJ9vx3ZEMkViv_B19ju-_ExN8Yn_uSefxpjS6g4Lw@mail.gmail.com/
      Link: https://github.com/libimobiledevice/libimobiledevice/issues/1038
      Link: https://lore.kernel.org/r/20201119172439.94988-1-corsac@corsac.net
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed73a61b
    • Anmol Karn's avatar
      rose: Fix Null pointer dereference in rose_send_frame() · f404d59d
      Anmol Karn authored
      
      [ Upstream commit 3b3fd068 ]
      
      rose_send_frame() dereferences `neigh->dev` when called from
      rose_transmit_clear_request(), and the first occurrence of the
      `neigh` is in rose_loopback_timer() as `rose_loopback_neigh`,
      and it is initialized in rose_add_loopback_neigh() as NULL.
      i.e when `rose_loopback_neigh` used in rose_loopback_timer()
      its `->dev` was still NULL and rose_loopback_timer() was calling
      rose_rx_call_request() without checking for NULL.
      
      - net/rose/rose_link.c
      This bug seems to get triggered in this line:
      
      rose_call = (ax25_address *)neigh->dev->dev_addr;
      
      Fix it by adding NULL checking for `rose_loopback_neigh->dev`
      in rose_loopback_timer().
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Suggested-by: default avatarJakub Kicinski <kuba@kernel.org>
      Reported-by: default avatar <syzbot+a1c743815982d9496393@syzkaller.appspotmail.com>
      Tested-by: default avatar <syzbot+a1c743815982d9496393@syzkaller.appspotmail.com>
      Link: https://syzkaller.appspot.com/bug?id=9d2a7ca8c7f2e4b682c97578dfa3f236258300b3
      
      
      Signed-off-by: default avatarAnmol Karn <anmol.karan123@gmail.com>
      Link: https://lore.kernel.org/r/20201119191043.28813-1-anmol.karan123@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f404d59d
    • Julian Wiedmann's avatar
      net/af_iucv: set correct sk_protocol for child sockets · a3564ff7
      Julian Wiedmann authored
      
      [ Upstream commit c5dab094 ]
      
      Child sockets erroneously inherit their parent's sk_type (ie. SOCK_*),
      instead of the PF_IUCV protocol that the parent was created with in
      iucv_sock_create().
      
      We're currently not using sk->sk_protocol ourselves, so this shouldn't
      have much impact (except eg. getting the output in skb_dump() right).
      
      Fixes: eac3731b ("[S390]: Add AF_IUCV socket support")
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Link: https://lore.kernel.org/r/20201120100657.34407-1-jwi@linux.ibm.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a3564ff7
  2. Dec 02, 2020
Loading