1. 20 Jun, 2018 23 commits
  2. 16 Jun, 2018 17 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.14.50 · cda6fd4d
      Greg Kroah-Hartman authored
      cda6fd4d
    • Bin Liu's avatar
      crypto: omap-sham - fix memleak · 87883c89
      Bin Liu authored
      commit 9dbc8a03 upstream.
      
      Fixes: 8043bb1a ("crypto: omap-sham - convert driver logic to use sgs for data xmit")
      
      The memory pages freed in omap_sham_finish_req() were less than those
      allocated in omap_sham_copy_sgs().
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarBin Liu <b-liu@ti.com>
      Acked-by: default avatarTero Kristo <t-kristo@ti.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      87883c89
    • Michael Ellerman's avatar
      crypto: vmx - Remove overly verbose printk from AES XTS init · efc67e74
      Michael Ellerman authored
      commit 730f23b6 upstream.
      
      In p8_aes_xts_init() we do a printk(KERN_INFO ...) to report the
      fallback implementation we're using. However with a slow console this
      can significantly affect the speed of crypto operations. So remove it.
      
      Fixes: c07f5d3d ("crypto: vmx - Adding support for XTS")
      Cc: stable@vger.kernel.org # v4.8+
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      efc67e74
    • Michael Ellerman's avatar
      crypto: vmx - Remove overly verbose printk from AES init routines · 1bc36d12
      Michael Ellerman authored
      commit 1411b521 upstream.
      
      In the vmx AES init routines we do a printk(KERN_INFO ...) to report
      the fallback implementation we're using.
      
      However with a slow console this can significantly affect the speed of
      crypto operations. Using 'cryptsetup benchmark' the removal of the
      printk() leads to a ~5x speedup for aes-cbc decryption.
      
      So remove them.
      
      Fixes: 8676590a ("crypto: vmx - Adding AES routines for VMX module")
      Fixes: 8c755ace ("crypto: vmx - Adding CBC routines for VMX module")
      Fixes: 4f7f60d3 ("crypto: vmx - Adding CTR routines for VMX module")
      Fixes: cc333cd6 ("crypto: vmx - Adding GHASH routines for VMX module")
      Cc: stable@vger.kernel.org # v4.1+
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1bc36d12
    • Jan Glauber's avatar
      crypto: cavium - Limit result reading attempts · b9705796
      Jan Glauber authored
      commit c782a8c4 upstream.
      
      After issuing a request an endless loop was used to read the
      completion state from memory which is asynchronously updated
      by the ZIP coprocessor.
      
      Add an upper bound to the retry attempts to prevent a CPU getting stuck
      forever in case of an error. Additionally, add a read memory barrier
      and a small delay between the reading attempts.
      Signed-off-by: default avatarJan Glauber <jglauber@cavium.com>
      Reviewed-by: default avatarRobert Richter <rrichter@cavium.com>
      Cc: stable <stable@vger.kernel.org> # 4.14
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b9705796
    • Jan Glauber's avatar
      crypto: cavium - Fix fallout from CONFIG_VMAP_STACK · 072e8b1f
      Jan Glauber authored
      commit 37ff02ac upstream.
      
      Enabling virtual mapped kernel stacks breaks the thunderx_zip
      driver. On compression or decompression the executing CPU hangs
      in an endless loop. The reason for this is the usage of __pa
      by the driver which does no longer work for an address that is
      not part of the 1:1 mapping.
      
      The zip driver allocates a result struct on the stack and needs
      to tell the hardware the physical address within this struct
      that is used to signal the completion of the request.
      
      As the hardware gets the wrong address after the broken __pa
      conversion it writes to an arbitrary address. The zip driver then
      waits forever for the completion byte to contain a non-zero value.
      
      Allocating the result struct from 1:1 mapped memory resolves this
      bug.
      Signed-off-by: default avatarJan Glauber <jglauber@cavium.com>
      Reviewed-by: default avatarRobert Richter <rrichter@cavium.com>
      Cc: stable <stable@vger.kernel.org> # 4.14
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      072e8b1f
    • Horia Geantă's avatar
      crypto: caam - fix size of RSA prime factor q · 4854c879
      Horia Geantă authored
      commit 4bffaab3 upstream.
      
      Fix a typo where size of RSA prime factor q is using the size of
      prime factor p.
      
      Cc: <stable@vger.kernel.org> # 4.13+
      Fixes: 52e26d77 ("crypto: caam - add support for RSA key form 2")
      Fixes: 4a651b12 ("crypto: caam - add support for RSA key form 3")
      Reported-by: default avatarDavid Binderman <dcb314@hotmail.com>
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4854c879
    • Horia Geantă's avatar
      crypto: caam/qi - fix IV DMA mapping and updating · f535e1c3
      Horia Geantă authored
      commit 3a488aae upstream.
      
      There are two IV-related issues:
      (1) crypto API does not guarantee to provide an IV buffer that is DMAable,
      thus it's incorrect to DMA map it
      (2) for in-place decryption, since ciphertext is overwritten with
      plaintext, updated IV (req->info) will contain the last block of plaintext
      (instead of the last block of ciphertext)
      
      While these two issues could be fixed separately, it's straightforward
      to fix both in the same time - by using the {ablkcipher,aead}_edesc
      extended descriptor to store the IV that will be fed to the crypto engine;
      this allows for fixing (2) by saving req->src[last_block] in req->info
      directly, i.e. without allocating yet another temporary buffer.
      
      A side effect of the fix is that it's no longer possible to have the IV
      contiguous with req->src or req->dst.
      Code checking for this case is removed.
      
      Cc: <stable@vger.kernel.org> # 4.14+
      Fixes: a68a1938 ("crypto: caam/qi - properly set IV after {en,de}crypt")
      Link: http://lkml.kernel.org/r/20170113084620.GF22022@gondor.apana.org.auReported-by: default avatarGilad Ben-Yossef <gilad@benyossef.com>
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f535e1c3
    • Horia Geantă's avatar
      crypto: caam - fix IV DMA mapping and updating · 9ed3135c
      Horia Geantă authored
      commit 115957bb upstream.
      
      There are two IV-related issues:
      (1) crypto API does not guarantee to provide an IV buffer that is DMAable,
      thus it's incorrect to DMA map it
      (2) for in-place decryption, since ciphertext is overwritten with
      plaintext, updated req->info will contain the last block of plaintext
      (instead of the last block of ciphertext)
      
      While these two issues could be fixed separately, it's straightforward
      to fix both in the same time - by allocating extra space in the
      ablkcipher_edesc for the IV that will be fed to the crypto engine;
      this allows for fixing (2) by saving req->src[last_block] in req->info
      directly, i.e. without allocating another temporary buffer.
      
      A side effect of the fix is that it's no longer possible to have the IV
      and req->src contiguous. Code checking for this case is removed.
      
      Cc: <stable@vger.kernel.org> # 4.13+
      Fixes: 854b06f7 ("crypto: caam - properly set IV after {en,de}crypt")
      Link: http://lkml.kernel.org/r/20170113084620.GF22022@gondor.apana.org.auReported-by: default avatarGilad Ben-Yossef <gilad@benyossef.com>
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9ed3135c
    • Horia Geantă's avatar
      crypto: caam - fix DMA mapping dir for generated IV · 635ac89e
      Horia Geantă authored
      commit a38acd23 upstream.
      
      In case of GIVCIPHER, IV is generated by the device.
      Fix the DMA mapping direction.
      
      Cc: <stable@vger.kernel.org> # 3.19+
      Fixes: 7222d1a3 ("crypto: caam - add support for givencrypt cbc(aes) and rfc3686(ctr(aes))")
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      635ac89e
    • Horia Geantă's avatar
      crypto: caam - strip input zeros from RSA input buffer · ed0a7956
      Horia Geantă authored
      commit 8a2a0dd3 upstream.
      
      Sometimes the provided RSA input buffer provided is not stripped
      of leading zeros. This could cause its size to be bigger than that
      of the modulus, making the HW complain:
      
      caam_jr 2142000.jr1: 40000789: DECO: desc idx 7:
      Protocol Size Error - A protocol has seen an error in size. When
      running RSA, pdb size N < (size of F) when no formatting is used; or
      pdb size N < (F + 11) when formatting is used.
      
      Fix the problem by stripping off the leading zero from input data
      before feeding it to the CAAM accelerator.
      
      Fixes: 8c419778 ("crypto: caam - add support for RSA algorithm")
      Cc: <stable@vger.kernel.org> # 4.8+
      Reported-by: default avatarMartin Townsend <mtownsend1973@gmail.com>
      Link: https://lkml.kernel.org/r/CABatt_ytYORYKtApcB4izhNanEKkGFi9XAQMjHi_n-8YWoCRiw@mail.gmail.comSigned-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Tested-by: default avatarFabio Estevam <fabio.estevam@nxp.com>
      Reviewed-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed0a7956
    • Johannes Wienke's avatar
      Input: elan_i2c - add ELAN0612 (Lenovo v330 14IKB) ACPI ID · 3c42aa03
      Johannes Wienke authored
      commit e6e7e9cd upstream.
      
      Add ELAN0612 to the list of supported touchpads; this ID is used in Lenovo
      v330 14IKB devices.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199253Signed-off-by: default avatarJohannes Wienke <languitar@semipol.de>
      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>
      3c42aa03
    • Ethan Lee's avatar
      Input: goodix - add new ACPI id for GPD Win 2 touch screen · c4168f19
      Ethan Lee authored
      commit 5ca4d1ae upstream.
      
      GPD Win 2 Website: http://www.gpd.hk/gpdwin2.asp
      
      Tested on a unit from the first production run sent to Indiegogo backers
      Signed-off-by: default avatarEthan Lee <flibitijibibo@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>
      c4168f19
    • Paolo Bonzini's avatar
      kvm: x86: use correct privilege level for sgdt/sidt/fxsave/fxrstor access · 53e4b19f
      Paolo Bonzini authored
      commit 3c9fa24c upstream.
      
      The functions that were used in the emulation of fxrstor, fxsave, sgdt and
      sidt were originally meant for task switching, and as such they did not
      check privilege levels.  This is very bad when the same functions are used
      in the emulation of unprivileged instructions.  This is CVE-2018-10853.
      
      The obvious fix is to add a new argument to ops->read_std and ops->write_std,
      which decides whether the access is a "system" access or should use the
      processor's CPL.
      
      Fixes: 129a72a0 ("KVM: x86: Introduce segmented_write_std", 2017-01-12)
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      53e4b19f
    • Dave Martin's avatar
      tty: pl011: Avoid spuriously stuck-off interrupts · 739ac8f4
      Dave Martin authored
      commit 4a7e625c upstream.
      
      Commit 9b96fbac ("serial: PL011: clear pending interrupts")
      clears the RX and receive timeout interrupts on pl011 startup, to
      avoid a screaming-interrupt scenario that can occur when the
      firmware or bootloader leaves these interrupts asserted.
      
      This has been noted as an issue when running Linux on qemu [1].
      
      Unfortunately, the above fix seems to lead to potential
      misbehaviour if the RX FIFO interrupt is asserted _non_ spuriously
      on driver startup, if the RX FIFO is also already full to the
      trigger level.
      
      Clearing the RX FIFO interrupt does not change the FIFO fill level.
      In this scenario, because the interrupt is now clear and because
      the FIFO is already full to the trigger level, no new assertion of
      the RX FIFO interrupt can occur unless the FIFO is drained back
      below the trigger level.  This never occurs because the pl011
      driver is waiting for an RX FIFO interrupt to tell it that there is
      something to read, and does not read the FIFO at all until that
      interrupt occurs.
      
      Thus, simply clearing "spurious" interrupts on startup may be
      misguided, since there is no way to be sure that the interrupts are
      truly spurious, and things can go wrong if they are not.
      
      This patch instead clears the interrupt condition by draining the
      RX FIFO during UART startup, after clearing any potentially
      spurious interrupt.  This should ensure that an interrupt will
      definitely be asserted if the RX FIFO subsequently becomes
      sufficiently full.
      
      The drain is done at the point of enabling interrupts only.  This
      means that it will occur any time the UART is newly opened through
      the tty layer.  It will not apply to polled-mode use of the UART by
      kgdboc: since that scenario cannot use interrupts by design, this
      should not matter.  kgdboc will interact badly with "normal" use of
      the UART in any case: this patch makes no attempt to paper over
      such issues.
      
      This patch does not attempt to address the case where the RX FIFO
      fills faster than it can be drained: that is a pathological
      hardware design problem that is beyond the scope of the driver to
      work around.  As a failsafe, the number of poll iterations for
      draining the FIFO is limited to twice the FIFO size.  This will
      ensure that the kernel at least boots even if it is impossible to
      drain the FIFO for some reason.
      
      [1] [Qemu-devel] [Qemu-arm] [PATCH] pl011: do not put into fifo
      before enabled the interruption
      https://lists.gnu.org/archive/html/qemu-devel/2018-01/msg06446.htmlReported-by: default avatarWei Xu <xuwei5@hisilicon.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Fixes: 9b96fbac ("serial: PL011: clear pending interrupts")
      Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
      Cc: stable <stable@vger.kernel.org>
      Tested-by: default avatarWei Xu <xuwei5@hisilicon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      739ac8f4
    • Gil Kupfer's avatar
      vmw_balloon: fixing double free when batching mode is off · 5ee296fd
      Gil Kupfer authored
      commit b23220fe upstream.
      
      The balloon.page field is used for two different purposes if batching is
      on or off. If batching is on, the field point to the page which is used
      to communicate with with the hypervisor. If it is off, balloon.page
      points to the page that is about to be (un)locked.
      
      Unfortunately, this dual-purpose of the field introduced a bug: when the
      balloon is popped (e.g., when the machine is reset or the balloon driver
      is explicitly removed), the balloon driver frees, unconditionally, the
      page that is held in balloon.page.  As a result, if batching is
      disabled, this leads to double freeing the last page that is sent to the
      hypervisor.
      
      The following error occurs during rmmod when kernel checkers are on, and
      the balloon is not empty:
      
      [   42.307653] ------------[ cut here ]------------
      [   42.307657] Kernel BUG at ffffffffba1e4b28 [verbose debug info unavailable]
      [   42.307720] invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC
      [   42.312512] Modules linked in: vmw_vsock_vmci_transport vsock ppdev joydev vmw_balloon(-) input_leds serio_raw vmw_vmci parport_pc shpchp parport i2c_piix4 nfit mac_hid autofs4 vmwgfx drm_kms_helper hid_generic syscopyarea sysfillrect usbhid sysimgblt fb_sys_fops hid ttm mptspi scsi_transport_spi ahci mptscsih drm psmouse vmxnet3 libahci mptbase pata_acpi
      [   42.312766] CPU: 10 PID: 1527 Comm: rmmod Not tainted 4.12.0+ #5
      [   42.312803] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 09/30/2016
      [   42.313042] task: ffff9bf9680f8000 task.stack: ffffbfefc1638000
      [   42.313290] RIP: 0010:__free_pages+0x38/0x40
      [   42.313510] RSP: 0018:ffffbfefc163be98 EFLAGS: 00010246
      [   42.313731] RAX: 000000000000003e RBX: ffffffffc02b9720 RCX: 0000000000000006
      [   42.313972] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff9bf97e08e0a0
      [   42.314201] RBP: ffffbfefc163be98 R08: 0000000000000000 R09: 0000000000000000
      [   42.314435] R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffc02b97e4
      [   42.314505] R13: ffffffffc02b9748 R14: ffffffffc02b9728 R15: 0000000000000200
      [   42.314550] FS:  00007f3af5fec700(0000) GS:ffff9bf97e080000(0000) knlGS:0000000000000000
      [   42.314599] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   42.314635] CR2: 00007f44f6f4ab24 CR3: 00000003a7d12000 CR4: 00000000000006e0
      [   42.314864] Call Trace:
      [   42.315774]  vmballoon_pop+0x102/0x130 [vmw_balloon]
      [   42.315816]  vmballoon_exit+0x42/0xd64 [vmw_balloon]
      [   42.315853]  SyS_delete_module+0x1e2/0x250
      [   42.315891]  entry_SYSCALL_64_fastpath+0x23/0xc2
      [   42.315924] RIP: 0033:0x7f3af5b0e8e7
      [   42.315949] RSP: 002b:00007fffe6ce0148 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
      [   42.315996] RAX: ffffffffffffffda RBX: 000055be676401e0 RCX: 00007f3af5b0e8e7
      [   42.316951] RDX: 000000000000000a RSI: 0000000000000800 RDI: 000055be67640248
      [   42.317887] RBP: 0000000000000003 R08: 0000000000000000 R09: 1999999999999999
      [   42.318845] R10: 0000000000000883 R11: 0000000000000206 R12: 00007fffe6cdf130
      [   42.319755] R13: 0000000000000000 R14: 0000000000000000 R15: 000055be676401e0
      [   42.320606] Code: c0 74 1c f0 ff 4f 1c 74 02 5d c3 85 f6 74 07 e8 0f d8 ff ff 5d c3 31 f6 e8 c6 fb ff ff 5d c3 48 c7 c6 c8 0f c5 ba e8 58 be 02 00 <0f> 0b 66 0f 1f 44 00 00 66 66 66 66 90 48 85 ff 75 01 c3 55 48
      [   42.323462] RIP: __free_pages+0x38/0x40 RSP: ffffbfefc163be98
      [   42.325735] ---[ end trace 872e008e33f81508 ]---
      
      To solve the bug, we eliminate the dual purpose of balloon.page.
      
      Fixes: f220a80f ("VMware balloon: add batching to the vmw_balloon.")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarOleksandr Natalenko <onatalen@redhat.com>
      Signed-off-by: default avatarGil Kupfer <gilkup@gmail.com>
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Reviewed-by: default avatarXavier Deguillard <xdeguillard@vmware.com>
      Tested-by: default avatarOleksandr Natalenko <oleksandr@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ee296fd
    • Tony Lindgren's avatar
      serial: 8250: omap: Fix idling of clocks for unused uarts · a64ff0be
      Tony Lindgren authored
      commit 13dc04d0 upstream.
      
      I noticed that unused UARTs won't necessarily idle properly always
      unless at least one byte tx transfer is done first.
      
      After some debugging I narrowed down the problem to the scr register
      dma configuration bits that need to be set before softreset for the
      clocks to idle. Unless we do this, the module clkctrl idlest bits
      may be set to 1 instead of 3 meaning the clock will never idle and
      is blocking deeper idle states for the whole domain.
      
      This might be related to the configuration done by the bootloader
      or kexec booting where certain configurations cause the 8250 or
      the clkctrl clock to jam in a way where setting of the scr bits
      and reset is needed to clear it. I've tried diffing the 8250
      registers for the various modes, but did not see anything specific.
      So far I've only seen this on omap4 but I'm suspecting this might
      also happen on the other clkctrl using SoCs considering they
      already have a quirk enabled for UART_ERRATA_CLOCK_DISABLE.
      
      Let's fix the issue by configuring scr before reset for basic dma
      even if we don't use it. The scr register will be reset when we do
      softreset few lines after, and we restore scr on resume. We should
      do this for all the SoCs with UART_ERRATA_CLOCK_DISABLE quirk flag
      set since the ones with UART_ERRATA_CLOCK_DISABLE are all based
      using clkctrl similar to omap4.
      
      Looks like both OMAP_UART_SCR_DMAMODE_1 | OMAP_UART_SCR_DMAMODE_CTL
      bits are needed for the clkctrl to idle after a softreset.
      
      And we need to add omap4 to also use the UART_ERRATA_CLOCK_DISABLE
      for the related workaround to be enabled. This same compatible
      value will also be used for omap5.
      
      Fixes: cdb929e4 ("serial: 8250_omap: workaround errata around idling UART after using DMA")
      Cc: Keerthy <j-keerthy@ti.com>
      Cc: Matthijs van Duin <matthijsvanduin@gmail.com>
      Cc: Sekhar Nori <nsekhar@ti.com>
      Cc: Tero Kristo <t-kristo@ti.com>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a64ff0be