Skip to content
  1. May 20, 2020
  2. May 10, 2020
  3. May 06, 2020
    • Greg Kroah-Hartman's avatar
      Linux 4.9.222 · ffd00fbc
      Greg Kroah-Hartman authored
      v4.9.222
      ffd00fbc
    • Vasily Averin's avatar
      drm/qxl: qxl_release use after free · 39c4c5c7
      Vasily Averin authored
      commit 933db733 upstream.
      
      qxl_release should not be accesses after qxl_push_*_ring_release() calls:
      userspace driver can process submitted command quickly, move qxl_release
      into release_ring, generate interrupt and trigger garbage collector.
      
      It can lead to crashes in qxl driver or trigger memory corruption
      in some kmalloc-192 slab object
      
      Gerd Hoffmann proposes to swap the qxl_release_fence_buffer_objects() +
      qxl_push_{cursor,command}_ring_release() calls to close that race window.
      
      cc: stable@vger.kernel.org
      Fixes: f64122c1
      
       ("drm: add new QXL driver. (v1.4)")
      Signed-off-by: default avatarVasily Averin <vvs@virtuozzo.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/fa17b338-66ae-f299-68fe-8d32419d9071@virtuozzo.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      [backported to v4.9-stable]
      Signed-off-by: default avatarVasily Averin <vvs@virtuozzo.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      39c4c5c7
    • Paul Moore's avatar
      selinux: properly handle multiple messages in selinux_netlink_send() · 6affa87d
      Paul Moore authored
      commit fb739741
      
       upstream.
      
      Fix the SELinux netlink_send hook to properly handle multiple netlink
      messages in a single sk_buff; each message is parsed and subject to
      SELinux access control.  Prior to this patch, SELinux only inspected
      the first message in the sk_buff.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarStephen Smalley <stephen.smalley.work@gmail.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6affa87d
    • Andy Shevchenko's avatar
      dmaengine: dmatest: Fix iteration non-stop logic · e66e9687
      Andy Shevchenko authored
      commit b9f96020 upstream.
      
      Under some circumstances, i.e. when test is still running and about to
      time out and user runs, for example,
      
      	grep -H . /sys/module/dmatest/parameters/*
      
      the iterations parameter is not respected and test is going on and on until
      user gives
      
      	echo 0 > /sys/module/dmatest/parameters/run
      
      This is not what expected.
      
      The history of this bug is interesting. I though that the commit
        2d88ce76 ("dmatest: add a 'wait' parameter")
      is a culprit, but looking closer to the code I think it simple revealed the
      broken logic from the day one, i.e. in the commit
        0a2ff57d ("dmaengine: dmatest: add a maximum number of test iterations")
      which adds iterations parameter.
      
      So, to the point, the conditional of checking the thread to be stopped being
      first part of conjunction logic prevents to check iterations. Thus, we have to
      always check both conditions to be able to stop after given iterations.
      
      Since it wasn't visible before second commit appeared, I add a respective
      Fixes tag.
      
      Fixes: 2d88ce76
      
       ("dmatest: add a 'wait' parameter")
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Link: https://lore.kernel.org/r/20200424161147.16895-1-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e66e9687
    • Andreas Gruenbacher's avatar
      nfs: Fix potential posix_acl refcnt leak in nfs3_set_acl · f92f2904
      Andreas Gruenbacher authored
      commit 7648f939 upstream.
      
      nfs3_set_acl keeps track of the acl it allocated locally to determine if an acl
      needs to be released at the end.  This results in a memory leak when the
      function allocates an acl as well as a default acl.  Fix by releasing acls
      that differ from the acl originally passed into nfs3_set_acl.
      
      Fixes: b7fa0554
      
       ("[PATCH] NFS: Add support for NFSv3 ACLs")
      Reported-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f92f2904
    • Arnd Bergmann's avatar
      ALSA: opti9xx: shut up gcc-10 range warning · a4dc992b
      Arnd Bergmann authored
      commit 5ce00760 upstream.
      
      gcc-10 points out a few instances of suspicious integer arithmetic
      leading to value truncation:
      
      sound/isa/opti9xx/opti92x-ad1848.c: In function 'snd_opti9xx_configure':
      sound/isa/opti9xx/opti92x-ad1848.c:322:43: error: overflow in conversion from 'int' to 'unsigned char' changes value from '(int)snd_opti9xx_read(chip, 3) & -256 | 240' to '240' [-Werror=overflow]
        322 |   (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask)))
            |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      sound/isa/opti9xx/opti92x-ad1848.c:351:3: note: in expansion of macro 'snd_opti9xx_write_mask'
        351 |   snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff);
            |   ^~~~~~~~~~~~~~~~~~~~~~
      sound/isa/opti9xx/miro.c: In function 'snd_miro_configure':
      sound/isa/opti9xx/miro.c:873:40: error: overflow in conversion from 'int' to 'unsigned char' changes value from '(int)snd_miro_read(chip, 3) & -256 | 240' to '240' [-Werror=overflow]
        873 |   (snd_miro_read(chip, reg) & ~(mask)) | ((value) & (mask)))
            |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      sound/isa/opti9xx/miro.c:1010:3: note: in expansion of macro 'snd_miro_write_mask'
       1010 |   snd_miro_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff);
            |   ^~~~~~~~~~~~~~~~~~~
      
      These are all harmless here as only the low 8 bit are passed down
      anyway. Change the macros to inline functions to make the code
      more readable and also avoid the warning.
      
      Strictly speaking those functions also need locking to make the
      read/write pair atomic, but it seems unlikely that anyone would
      still run into that issue.
      
      Fixes: 1841f613
      
       ("[ALSA] Add snd-miro driver")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20200429190216.85919-1-arnd@arndb.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a4dc992b
    • Suravee Suthikulpanit's avatar
      iommu/amd: Fix legacy interrupt remapping for x2APIC-enabled system · a6d4fb7c
      Suravee Suthikulpanit authored
      commit b74aa02d upstream.
      
      Currently, system fails to boot because the legacy interrupt remapping
      mode does not enable 128-bit IRTE (GA), which is required for x2APIC
      support.
      
      Fix by using AMD_IOMMU_GUEST_IR_LEGACY_GA mode when booting with
      kernel option amd_iommu_intr=legacy instead. The initialization
      logic will check GASup and automatically fallback to using
      AMD_IOMMU_GUEST_IR_LEGACY if GA mode is not supported.
      
      Fixes: 3928aa3f
      
       ("iommu/amd: Detect and enable guest vAPIC support")
      Signed-off-by: default avatarSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
      Link: https://lore.kernel.org/r/1587562202-14183-1-git-send-email-suravee.suthikulpanit@amd.com
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a6d4fb7c
    • Sean Christopherson's avatar
      vfio/type1: Fix VA->PA translation for PFNMAP VMAs in vaddr_get_pfn() · f9980f56
      Sean Christopherson authored
      commit 5cbf3264 upstream.
      
      Use follow_pfn() to get the PFN of a PFNMAP VMA instead of assuming that
      vma->vm_pgoff holds the base PFN of the VMA.  This fixes a bug where
      attempting to do VFIO_IOMMU_MAP_DMA on an arbitrary PFNMAP'd region of
      memory calculates garbage for the PFN.
      
      Hilariously, this only got detected because the first "PFN" calculated
      by vaddr_get_pfn() is PFN 0 (vma->vm_pgoff==0), and iommu_iova_to_phys()
      uses PA==0 as an error, which triggers a WARN in vfio_unmap_unpin()
      because the translation "failed".  PFN 0 is now unconditionally reserved
      on x86 in order to mitigate L1TF, which causes is_invalid_reserved_pfn()
      to return true and in turns results in vaddr_get_pfn() returning success
      for PFN 0.  Eventually the bogus calculation runs into PFNs that aren't
      reserved and leads to failure in vfio_pin_map_dma().  The subsequent
      call to vfio_remove_dma() attempts to unmap PFN 0 and WARNs.
      
        WARNING: CPU: 8 PID: 5130 at drivers/vfio/vfio_iommu_type1.c:750 vfio_unmap_unpin+0x2e1/0x310 [vfio_iommu_type1]
        Modules linked in: vfio_pci vfio_virqfd vfio_iommu_type1 vfio ...
        CPU: 8 PID: 5130 Comm: sgx Tainted: G        W         5.6.0-rc5-705d787c7fee-vfio+ #3
        Hardware name: Intel Corporation Mehlow UP Server Platform/Moss Beach Server, BIOS CNLSE2R1.D00.X119.B49.1803010910 03/01/2018
        RIP: 0010:vfio_unmap_unpin+0x2e1/0x310 [vfio_iommu_type1]
        Code: <0f> 0b 49 81 c5 00 10 00 00 e9 c5 fe ff ff bb 00 10 00 00 e9 3d fe
        RSP: 0018:ffffbeb5039ebda8 EFLAGS: 00010246
        RAX: 0000000000000000 RBX: ffff9a55cbf8d480 RCX: 0000000000000000
        RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff9a52b771c200
        RBP: 0000000000000000 R08: 0000000000000040 R09: 00000000fffffff2
        R10: 0000000000000001 R11: ffff9a51fa896000 R12: 0000000184010000
        R13: 0000000184000000 R14: 0000000000010000 R15: ffff9a55cb66ea08
        FS:  00007f15d3830b40(0000) GS:ffff9a55d5600000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000561cf39429e0 CR3: 000000084f75f005 CR4: 00000000003626e0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
         vfio_remove_dma+0x17/0x70 [vfio_iommu_type1]
         vfio_iommu_type1_ioctl+0x9e3/0xa7b [vfio_iommu_type1]
         ksys_ioctl+0x92/0xb0
         __x64_sys_ioctl+0x16/0x20
         do_syscall_64+0x4c/0x180
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x7f15d04c75d7
        Code: <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 81 48 2d 00 f7 d8 64 89 01 48
      
      Fixes: 73fa0d10
      
       ("vfio: Type1 IOMMU implementation")
      Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f9980f56
    • Alaa Hleihel's avatar
      RDMA/mlx4: Initialize ib_spec on the stack · 7fbf5316
      Alaa Hleihel authored
      commit c08cfb2d upstream.
      
      Initialize ib_spec on the stack before using it, otherwise we will have
      garbage values that will break creating default rules with invalid parsing
      error.
      
      Fixes: a37a1a42
      
       ("IB/mlx4: Add mechanism to support flow steering over IB links")
      Link: https://lore.kernel.org/r/20200413132235.930642-1-leon@kernel.org
      Signed-off-by: default avatarAlaa Hleihel <alaa@mellanox.com>
      Reviewed-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7fbf5316
    • Sunwook Eom's avatar
      dm verity fec: fix hash block number in verity_fec_decode · 779bb362
      Sunwook Eom authored
      commit ad4e80a6 upstream.
      
      The error correction data is computed as if data and hash blocks
      were concatenated. But hash block number starts from v->hash_start.
      So, we have to calculate hash block number based on that.
      
      Fixes: a739ff3f
      
       ("dm verity: add support for forward error correction")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSunwook Eom <speed.eom@samsung.com>
      Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      779bb362
    • Dexuan Cui's avatar
      PM: hibernate: Freeze kernel threads in software_resume() · 9199193d
      Dexuan Cui authored
      commit 2351f8d2
      
       upstream.
      
      Currently the kernel threads are not frozen in software_resume(), so
      between dpm_suspend_start(PMSG_QUIESCE) and resume_target_kernel(),
      system_freezable_power_efficient_wq can still try to submit SCSI
      commands and this can cause a panic since the low level SCSI driver
      (e.g. hv_storvsc) has quiesced the SCSI adapter and can not accept
      any SCSI commands: https://lkml.org/lkml/2020/4/10/47
      
      At first I posted a fix (https://lkml.org/lkml/2020/4/21/1318) trying
      to resolve the issue from hv_storvsc, but with the help of
      Bart Van Assche, I realized it's better to fix software_resume(),
      since this looks like a generic issue, not only pertaining to SCSI.
      
      Cc: All applicable <stable@vger.kernel.org>
      Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9199193d