1. 19 Feb, 2016 3 commits
    • Jaegeuk Kim's avatar
      f2fs crypto: allocate buffer for decrypting filename · a349da65
      Jaegeuk Kim authored
      commit 569cf187 upstream.
      
      We got dentry pages from high_mem, and its address space directly goes into the
      decryption path via f2fs_fname_disk_to_usr.
      But, sg_init_one assumes the address is not from high_mem, so we can get this
      panic since it doesn't call kmap_high but kunmap_high is triggered at the end.
      
      kernel BUG at ../../../../../../kernel/mm/highmem.c:290!
      Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
      ...
       (kunmap_high+0xb0/0xb8) from [<c0114534>] (__kunmap_atomic+0xa0/0xa4)
       (__kunmap_atomic+0xa0/0xa4) from [<c035f028>] (blkcipher_walk_done+0x128/0x1ec)
       (blkcipher_walk_done+0x128/0x1ec) from [<c0366c24>] (crypto_cbc_decrypt+0xc0/0x170)
       (crypto_cbc_decrypt+0xc0/0x170) from [<c0367148>] (crypto_cts_decrypt+0xc0/0x114)
       (crypto_cts_decrypt+0xc0/0x114) from [<c035ea98>] (async_decrypt+0x40/0x48)
       (async_decrypt+0x40/0x48) from [<c032ca34>] (f2fs_fname_disk_to_usr+0x124/0x304)
       (f2fs_fname_disk_to_usr+0x124/0x304) from [<c03056fc>] (f2fs_fill_dentries+0xac/0x188)
       (f2fs_fill_dentries+0xac/0x188) from [<c03059c8>] (f2fs_readdir+0x1f0/0x300)
       (f2fs_readdir+0x1f0/0x300) from [<c0218054>] (vfs_readdir+0x90/0xb4)
       (vfs_readdir+0x90/0xb4) from [<c0218418>] (SyS_getdents64+0x64/0xcc)
       (SyS_getdents64+0x64/0xcc) from [<c0105ba0>] (ret_fast_syscall+0x0/0x30)
      Reviewed-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a349da65
    • Russell King's avatar
      crypto: caam - fix non-block aligned hash calculation · c084696a
      Russell King authored
      commit c7556ff7 upstream.
      
      caam does not properly calculate the size of the retained state
      when non-block aligned hashes are requested - it uses the wrong
      buffer sizes, which results in errors such as:
      
      caam_jr 2102000.jr1: 40000501: DECO: desc idx 5: SGT Length Error. The descriptor is trying to read more data than is contained in the SGT table.
      
      We end up here with:
      
      in_len 0x46 blocksize 0x40 last_bufsize 0x0 next_bufsize 0x6
      to_hash 0x40 ctx_len 0x28 nbytes 0x20
      
      which results in a job descriptor of:
      
      jobdesc@889: ed03d918: b0861c08 3daa0080 f1400000 3d03d938
      jobdesc@889: ed03d928: 00000068 f8400000 3cde2a40 00000028
      
      where the word at 0xed03d928 is the expected data size (0x68), and a
      scatterlist containing:
      
      sg@892: ed03d938: 00000000 3cde2a40 00000028 00000000
      sg@892: ed03d948: 00000000 3d03d100 00000006 00000000
      sg@892: ed03d958: 00000000 7e8aa700 40000020 00000000
      
      0x68 comes from 0x28 (the context size) plus the "in_len" rounded down
      to a block size (0x40).  in_len comes from 0x26 bytes of unhashed data
      from the previous operation, plus the 0x20 bytes from the latest
      operation.
      
      The fixed version would create:
      
      sg@892: ed03d938: 00000000 3cde2a40 00000028 00000000
      sg@892: ed03d948: 00000000 3d03d100 00000026 00000000
      sg@892: ed03d958: 00000000 7e8aa700 40000020 00000000
      
      which replaces the 0x06 length with the correct 0x26 bytes of previously
      unhashed data.
      
      This fixes a previous commit which erroneously "fixed" this due to a
      DMA-API bug report; that commit indicates that the bug was caused via a
      test_ahash_pnum() function in the tcrypt module.  No such function has
      ever existed in the mainline kernel.  Given that the change in this
      commit has been tested with DMA API debug enabled and shows no issue,
      I can only conclude that test_ahash_pnum() was triggering that bad
      behaviour by CAAM.
      
      Fixes: 7d5196ab ("crypto: caam - Correct DMA unmap size in ahash_update_ctx()")
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c084696a
    • Nicolas Iooss's avatar
      crypto: crc32c-pclmul - use .rodata instead of .rotata · 7333f7d6
      Nicolas Iooss authored
      commit 97bce7e0 upstream.
      
      Module crc32c-intel uses a special read-only data section named .rotata.
      This section is defined for K_table, and its name seems to be a spelling
      mistake for .rodata.
      
      Fixes: 473946e6 ("crypto: crc32c-pclmul - Shrink K_table to 32-bit words")
      Signed-off-by: default avatarNicolas Iooss <nicolas.iooss_linux@m4x.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7333f7d6
  2. 31 Jan, 2016 37 commits