1. 16 Mar, 2018 13 commits
  2. 09 Mar, 2018 23 commits
  3. 02 Mar, 2018 4 commits
    • Brijesh Singh's avatar
      include: psp-sev: Capitalize invalid length enum · 23ea8b63
      Brijesh Singh authored
      Commit 1d57b17c ("crypto: ccp: Define SEV userspace ioctl and command
      id") added the invalid length enum but we missed capitalizing it.
      
      Fixes: 1d57b17c (crypto: ccp: Define SEV userspace ioctl ...)
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      CC: Gary R Hook <gary.hook@amd.com>
      Signed-off-by: default avatarBrijesh Singh <brijesh.singh@amd.com>
      Acked-by: default avatarGary R Hook <gary.hook@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      23ea8b63
    • Brijesh Singh's avatar
      crypto: ccp - Fix sparse, use plain integer as NULL pointer · e385b5b7
      Brijesh Singh authored
      Fix sparse warning: Using plain integer as NULL pointer. Replaces
      assignment of 0 to pointer with NULL assignment.
      
      Fixes: 200664d5 (Add Secure Encrypted Virtualization ...)
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Gary Hook <gary.hook@amd.com>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: default avatarBrijesh Singh <brijesh.singh@amd.com>
      Acked-by: default avatarGary R Hook <gary.hook@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      e385b5b7
    • Maciej S. Szmigiero's avatar
      crypto: ccp - return an actual key size from RSA max_size callback · 0a9eb80e
      Maciej S. Szmigiero authored
      rsa-pkcs1pad uses a value returned from a RSA implementation max_size
      callback as a size of an input buffer passed to the RSA implementation for
      encrypt and sign operations.
      
      CCP RSA implementation uses a hardware input buffer which size depends only
      on the current RSA key length, so it should return this key length in
      the max_size callback, too.
      This also matches what the kernel software RSA implementation does.
      
      Previously, the value returned from this callback was always the maximum
      RSA key size the CCP hardware supports.
      This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
      for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
      tried to copy this large input buffer into a RSA key length-sized hardware
      input buffer.
      Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Fixes: ceeec0af ("crypto: ccp - Add support for RSA on the CCP")
      Cc: stable@vger.kernel.org
      Acked-by: default avatarGary R Hook <gary.hook@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      0a9eb80e
    • Sebastian Andrzej Siewior's avatar
      crypto: ccp - don't disable interrupts while setting up debugfs · 79eb382b
      Sebastian Andrzej Siewior authored
      I don't why we need take a single write lock and disable interrupts
      while setting up debugfs. This is what what happens when we try anyway:
      
      |ccp 0000:03:00.2: enabling device (0000 -> 0002)
      |BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:69
      |in_atomic(): 1, irqs_disabled(): 1, pid: 3, name: kworker/0:0
      |irq event stamp: 17150
      |hardirqs last  enabled at (17149): [<0000000097a18c49>] restore_regs_and_return_to_kernel+0x0/0x23
      |hardirqs last disabled at (17150): [<000000000773b3a9>] _raw_write_lock_irqsave+0x1b/0x50
      |softirqs last  enabled at (17148): [<0000000064d56155>] __do_softirq+0x3b8/0x4c1
      |softirqs last disabled at (17125): [<0000000092633c18>] irq_exit+0xb1/0xc0
      |CPU: 0 PID: 3 Comm: kworker/0:0 Not tainted 4.16.0-rc2+ #30
      |Workqueue: events work_for_cpu_fn
      |Call Trace:
      | dump_stack+0x7d/0xb6
      | ___might_sleep+0x1eb/0x250
      | down_write+0x17/0x60
      | start_creating+0x4c/0xe0
      | debugfs_create_dir+0x9/0x100
      | ccp5_debugfs_setup+0x191/0x1b0
      | ccp5_init+0x8a7/0x8c0
      | ccp_dev_init+0xb8/0xe0
      | sp_init+0x6c/0x90
      | sp_pci_probe+0x26e/0x590
      | local_pci_probe+0x3f/0x90
      | work_for_cpu_fn+0x11/0x20
      | process_one_work+0x1ff/0x650
      | worker_thread+0x1d4/0x3a0
      | kthread+0xfe/0x130
      | ret_from_fork+0x27/0x50
      
      If any locking is required, a simple mutex will do it.
      
      Cc: Gary R Hook <gary.hook@amd.com>
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: default avatarGary R Hook <gary.hook@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      79eb382b