1. 01 11月, 2016 1 次提交
  2. 25 10月, 2016 1 次提交
  3. 02 10月, 2016 2 次提交
  4. 22 9月, 2016 7 次提交
  5. 07 9月, 2016 1 次提交
  6. 31 8月, 2016 2 次提交
  7. 09 8月, 2016 13 次提交
    • R
      crypto: caam - avoid kernel warnings on probe failure · bdc67da7
      Russell King 提交于
      While debugging setkey issues, the following warnings were found while
      trying to reinsert the caam module.  Fix this by avoiding the duplicated
      cleanup in the probe path after caam_remove(), which has already cleaned
      up the resources.
      
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 2346 at /home/rmk/git/linux-rmk/mm/vmalloc.c:1490 __vunmap+0xcc/0xf4
      Trying to vfree() nonexistent vm area (f2400000)
      Modules linked in: caam(+) cbc rfcomm bnep bluetooth nfsd em28xx_rc si2157 si2168 em28xx_dvb uvcvideo snd_soc_imx_sgtl5000 em28xx snd_soc_imx_spdif tveeprom snd_soc_fsl_asoc_card snd_soc_imx_audmux snd_soc_sgtl5000 imx_sdma imx2_wdt coda v4l2_mem2mem videobuf2_dma_contig snd_soc_fsl_ssi rc_cec snd_soc_fsl_spdif imx_pcm_dma videobuf2_vmalloc videobuf2_memops imx_thermal dw_hdmi_ahb_audio dw_hdmi_cec etnaviv fuse rc_pinnacle_pctv_hd [last unloaded: caam]
      CPU: 0 PID: 2346 Comm: modprobe Tainted: G        W       4.8.0-rc1+ #2014
      Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
      Backtrace:
      [<c0013bb0>] (dump_backtrace) from [<c0013d4c>] (show_stack+0x18/0x1c)
      [<c0013d34>] (show_stack) from [<c0357c00>] (dump_stack+0xa4/0xdc)
      [<c0357b5c>] (dump_stack) from [<c002e650>] (__warn+0xdc/0x108)
      [<c002e574>] (__warn) from [<c002e734>] (warn_slowpath_fmt+0x40/0x48)
      [<c002e6f8>] (warn_slowpath_fmt) from [<c0151708>] (__vunmap+0xcc/0xf4)
      [<c015163c>] (__vunmap) from [<c015177c>] (vunmap+0x4c/0x54)
      [<c0151730>] (vunmap) from [<c001f48c>] (__iounmap+0x2c/0x30)
      [<c001f460>] (__iounmap) from [<c001f118>] (iounmap+0x1c/0x20)
      [<c001f0fc>] (iounmap) from [<bf247ae4>] (caam_probe+0x3dc/0x1498 [caam])
      [<bf247708>] (caam_probe [caam]) from [<c042da8c>] (platform_drv_probe+0x58/0xb8)
      [<c042da34>] (platform_drv_probe) from [<c042bb4c>] (driver_probe_device+0x1fc/0x2b8)
      [<c042b950>] (driver_probe_device) from [<c042bcc4>] (__driver_attach+0xbc/0xc0) r10:00000000 r8:bf24b000 r7:00000000 r6:ef215844 r5:bf2490c4 r4:ef215810
      [<c042bc08>] (__driver_attach) from [<c0429f14>] (bus_for_each_dev+0x5c/0x90)
      [<c0429eb8>] (bus_for_each_dev) from [<c042b358>] (driver_attach+0x24/0x28)
      [<c042b334>] (driver_attach) from [<c042b058>] (bus_add_driver+0xf4/0x200)
      [<c042af64>] (bus_add_driver) from [<c042cadc>] (driver_register+0x80/0xfc)
      [<c042ca5c>] (driver_register) from [<c042d960>] (__platform_driver_register+0x48/0x4c)
      [<c042d918>] (__platform_driver_register) from [<bf24b018>] (caam_driver_init+0x18/0x24 [caam])
      [<bf24b000>] (caam_driver_init [caam]) from [<c00098ac>] (do_one_initcall+0x44/0x178)
      [<c0009868>] (do_one_initcall) from [<c010e034>] (do_init_module+0x68/0x1d8)
      [<c010dfcc>] (do_init_module) from [<c00c8fbc>] (load_module+0x1974/0x20b0)
      [<c00c7648>] (load_module) from [<c00c98d0>] (SyS_finit_module+0x94/0xa0)
      [<c00c983c>] (SyS_finit_module) from [<c000fda0>] (ret_fast_syscall+0x0/0x1c)
      ---[ end trace 34e3370d88bb1786 ]---
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 2346 at /home/rmk/git/linux-rmk/drivers/clk/clk.c:594 clk_core_disable+0xe4/0x26c
      Modules linked in: caam(+) cbc rfcomm bnep bluetooth nfsd em28xx_rc si2157 si2168 em28xx_dvb uvcvideo snd_soc_imx_sgtl5000 em28xx snd_soc_imx_spdif tveeprom snd_soc_fsl_asoc_card snd_soc_imx_audmux snd_soc_sgtl5000 imx_sdma imx2_wdt coda v4l2_mem2mem videobuf2_dma_contig snd_soc_fsl_ssi rc_cec snd_soc_fsl_spdif imx_pcm_dma videobuf2_vmalloc videobuf2_memops imx_thermal dw_hdmi_ahb_audio dw_hdmi_cec etnaviv fuse rc_pinnacle_pctv_hd [last unloaded: caam]
      CPU: 0 PID: 2346 Comm: modprobe Tainted: G        W       4.8.0-rc1+ #2014
      Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
      Backtrace:
      [<c0013bb0>] (dump_backtrace) from [<c0013d4c>] (show_stack+0x18/0x1c)
      [<c0013d34>] (show_stack) from [<c0357c00>] (dump_stack+0xa4/0xdc)
      [<c0357b5c>] (dump_stack) from [<c002e650>] (__warn+0xdc/0x108)
      [<c002e574>] (__warn) from [<c002e6a4>] (warn_slowpath_null+0x28/0x30)
      [<c002e67c>] (warn_slowpath_null) from [<c05b113c>] (clk_core_disable+0xe4/0x26c)
      [<c05b1058>] (clk_core_disable) from [<c05b2e3c>] (clk_core_disable_lock+0x20/0x2c)
      [<c05b2e1c>] (clk_core_disable_lock) from [<c05b2e6c>] (clk_disable+0x24/0x28)
      [<c05b2e48>] (clk_disable) from [<bf247b04>] (caam_probe+0x3fc/0x1498 [caam])
      [<bf247708>] (caam_probe [caam]) from [<c042da8c>] (platform_drv_probe+0x58/0xb8)
      [<c042da34>] (platform_drv_probe) from [<c042bb4c>] (driver_probe_device+0x1fc/0x2b8)
      [<c042b950>] (driver_probe_device) from [<c042bcc4>] (__driver_attach+0xbc/0xc0) r10:00000000 r8:bf24b000 r7:00000000 r6:ef215844 r5:bf2490c4 r4:ef215810
      [<c042bc08>] (__driver_attach) from [<c0429f14>] (bus_for_each_dev+0x5c/0x90)
      [<c0429eb8>] (bus_for_each_dev) from [<c042b358>] (driver_attach+0x24/0x28)
      [<c042b334>] (driver_attach) from [<c042b058>] (bus_add_driver+0xf4/0x200)
      [<c042af64>] (bus_add_driver) from [<c042cadc>] (driver_register+0x80/0xfc)
      [<c042ca5c>] (driver_register) from [<c042d960>] (__platform_driver_register+0x48/0x4c)
      [<c042d918>] (__platform_driver_register) from [<bf24b018>] (caam_driver_init+0x18/0x24 [caam])
      [<bf24b000>] (caam_driver_init [caam]) from [<c00098ac>] (do_one_initcall+0x44/0x178)
      [<c0009868>] (do_one_initcall) from [<c010e034>] (do_init_module+0x68/0x1d8)
      [<c010dfcc>] (do_init_module) from [<c00c8fbc>] (load_module+0x1974/0x20b0)
      [<c00c7648>] (load_module) from [<c00c98d0>] (SyS_finit_module+0x94/0xa0)
      [<c00c983c>] (SyS_finit_module) from [<c000fda0>] (ret_fast_syscall+0x0/0x1c)
      ---[ end trace 34e3370d88bb1787 ]---
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 2346 at /home/rmk/git/linux-rmk/drivers/clk/clk.c:476 clk_core_unprepare+0x204/0x388
      Modules linked in: caam(+) cbc rfcomm bnep bluetooth nfsd em28xx_rc si2157 si2168 em28xx_dvb uvcvideo snd_soc_imx_sgtl5000 em28xx snd_soc_imx_spdif tveeprom snd_soc_fsl_asoc_card snd_soc_imx_audmux snd_soc_sgtl5000 imx_sdma imx2_wdt coda v4l2_mem2mem videobuf2_dma_contig snd_soc_fsl_ssi rc_cec snd_soc_fsl_spdif imx_pcm_dma videobuf2_vmalloc videobuf2_memops imx_thermal dw_hdmi_ahb_audio dw_hdmi_cec etnaviv fuse rc_pinnacle_pctv_hd [last unloaded: caam]
      CPU: 0 PID: 2346 Comm: modprobe Tainted: G        W       4.8.0-rc1+ #2014
      Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
      Backtrace:
      [<c0013bb0>] (dump_backtrace) from [<c0013d4c>] (show_stack+0x18/0x1c)
      [<c0013d34>] (show_stack) from [<c0357c00>] (dump_stack+0xa4/0xdc)
      [<c0357b5c>] (dump_stack) from [<c002e650>] (__warn+0xdc/0x108)
      [<c002e574>] (__warn) from [<c002e6a4>] (warn_slowpath_null+0x28/0x30)
      [<c002e67c>] (warn_slowpath_null) from [<c05b0834>] (clk_core_unprepare+0x204/0x388)
      [<c05b0630>] (clk_core_unprepare) from [<c05b4c0c>] (clk_unprepare+0x2c/0x34)
      [<c05b4be0>] (clk_unprepare) from [<bf247b0c>] (caam_probe+0x404/0x1498 [caam])
      [<bf247708>] (caam_probe [caam]) from [<c042da8c>] (platform_drv_probe+0x58/0xb8)
      [<c042da34>] (platform_drv_probe) from [<c042bb4c>] (driver_probe_device+0x1fc/0x2b8)
      [<c042b950>] (driver_probe_device) from [<c042bcc4>] (__driver_attach+0xbc/0xc0) r10:00000000 r8:bf24b000 r7:00000000 r6:ef215844 r5:bf2490c4 r4:ef215810
      [<c042bc08>] (__driver_attach) from [<c0429f14>] (bus_for_each_dev+0x5c/0x90)
      [<c0429eb8>] (bus_for_each_dev) from [<c042b358>] (driver_attach+0x24/0x28)
      [<c042b334>] (driver_attach) from [<c042b058>] (bus_add_driver+0xf4/0x200)
      [<c042af64>] (bus_add_driver) from [<c042cadc>] (driver_register+0x80/0xfc)
      [<c042ca5c>] (driver_register) from [<c042d960>] (__platform_driver_register+0x48/0x4c)
      [<c042d918>] (__platform_driver_register) from [<bf24b018>] (caam_driver_init+0x18/0x24 [caam])
      [<bf24b000>] (caam_driver_init [caam]) from [<c00098ac>] (do_one_initcall+0x44/0x178)
      [<c0009868>] (do_one_initcall) from [<c010e034>] (do_init_module+0x68/0x1d8)
      [<c010dfcc>] (do_init_module) from [<c00c8fbc>] (load_module+0x1974/0x20b0)
      [<c00c7648>] (load_module) from [<c00c98d0>] (SyS_finit_module+0x94/0xa0)
      [<c00c983c>] (SyS_finit_module) from [<c000fda0>] (ret_fast_syscall+0x0/0x1c)
      ---[ end trace 34e3370d88bb1788 ]---
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      bdc67da7
    • R
      crypto: caam - get rid of tasklet · 66d2e202
      Russell King 提交于
      Threaded interrupts can perform the function of the tasklet, and much
      more safely too - without races when trying to take the tasklet and
      interrupt down on device removal.
      
      With the old code, there is a window where we call tasklet_kill().  If
      the interrupt handler happens to be running on a different CPU, and
      subsequently calls tasklet_schedule(), the tasklet will be re-scheduled
      for execution.
      
      Switching to a hardirq/threadirq combination implementation avoids this,
      and it also means generic code deals with the teardown sequencing of the
      threaded and non-threaded parts.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      66d2e202
    • R
      crypto: caam - add ahash_edesc_add_src() · 65cf164a
      Russell King 提交于
      Add a helper to map the source scatterlist into the descriptor.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      65cf164a
    • R
    • R
      crypto: caam - add ahash_edesc_alloc() for descriptor allocation · 5588d039
      Russell King 提交于
      Add a helper function to perform the descriptor allocation.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      5588d039
    • R
      crypto: caam - check and use dma_map_sg() return code · bc13c69e
      Russell King 提交于
      Strictly, dma_map_sg() may coalesce SG entries, but in practise on iMX
      hardware, this will never happen.  However, dma_map_sg() can fail, and
      we completely fail to check its return value.  So, fix this properly.
      
      Arrange the code to map the scatterlist early, so we know how many
      scatter table entries to allocate, and then fill them in.  This allows
      us to keep relatively simple error cleanup paths.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      bc13c69e
    • R
      crypto: caam - ensure that we clean up after an error · 32686d34
      Russell King 提交于
      Ensure that we clean up allocations and DMA mappings after encountering
      an error rather than just giving up and leaking memory and resources.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      32686d34
    • R
      crypto: caam - replace sec4_sg pointer with array · 343e44b1
      Russell King 提交于
      Since the extended descriptor includes the hardware descriptor, and the
      sec4 scatterlist immediately follows this, we can declare it as a array
      at the very end of the extended descriptor.  This allows us to get rid
      of an initialiser for every site where we allocate an extended
      descriptor.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      343e44b1
    • R
      crypto: caam - mark the hardware descriptor as cache line aligned · d7b24ed4
      Russell King 提交于
      Mark the hardware descriptor as being cache line aligned; on DMA
      incoherent architectures, the hardware descriptor should sit in a
      separate cache line from the CPU accessed data to avoid polluting
      the caches.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      d7b24ed4
    • R
      crypto: caam - incorporate job descriptor into struct ahash_edesc · 64ce56cb
      Russell King 提交于
      Rather than giving the descriptor as hw_desc[0], give it's real size.
      All places where we allocate an ahash_edesc incorporate DESC_JOB_IO_LEN
      bytes of job descriptor.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      64ce56cb
    • R
    • R
      crypto: caam - fix DMA API mapping leak · 3d5a2db6
      Russell King 提交于
      caamhash contains this weird code:
      
      	src_nents = sg_count(req->src, req->nbytes);
      	dma_map_sg(jrdev, req->src, src_nents ? : 1, DMA_TO_DEVICE);
      	...
      	edesc->src_nents = src_nents;
      
      sg_count() returns zero when sg_nents_for_len() returns zero or one.
      This means we don't need to use a hardware scatterlist.  However,
      setting src_nents to zero causes problems when we unmap:
      
      	if (edesc->src_nents)
      		dma_unmap_sg_chained(dev, req->src, edesc->src_nents,
      				     DMA_TO_DEVICE, edesc->chained);
      
      as zero here means that we have no entries to unmap.  This causes us
      to leak DMA mappings, where we map one scatterlist entry and then
      fail to unmap it.
      
      This can be fixed in two ways: either by writing the number of entries
      that were requested of dma_map_sg(), or by reworking the "no SG
      required" case.
      
      We adopt the re-work solution here - we replace sg_count() with
      sg_nents_for_len(), so src_nents now contains the real number of
      scatterlist entries, and we then change the test for using the
      hardware scatterlist to src_nents > 1 rather than just non-zero.
      
      This change passes my sshd, openssl tests hashing /bin and tcrypt
      tests.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      3d5a2db6
    • R
      crypto: caam - fix non-hmac hashes · a0118c8b
      Russell King 提交于
      Since 6de62f15 ("crypto: algif_hash - Require setkey before
      accept(2)"), the AF_ALG interface requires userspace to provide a key
      to any algorithm that has a setkey method.  However, the non-HMAC
      algorithms are not keyed, so setting a key is unnecessary.
      
      Fix this by removing the setkey method from the non-keyed hash
      algorithms.
      
      Fixes: 6de62f15 ("crypto: algif_hash - Require setkey before accept(2)")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      a0118c8b
  8. 08 8月, 2016 2 次提交
    • H
      crypto: caam - defer aead_set_sh_desc in case of zero authsize · 2fdea258
      Horia Geantă 提交于
      To be able to generate shared descriptors for AEAD, the authentication size
      needs to be known. However, there is no imposed order of calling .setkey,
      .setauthsize callbacks.
      
      Thus, in case authentication size is not known at .setkey time, defer it
      until .setauthsize is called.
      
      The authsize != 0 check was incorrectly removed when converting the driver
      to the new AEAD interface.
      
      Cc: <stable@vger.kernel.org> # 4.3+
      Fixes: 479bcc7c ("crypto: caam - Convert authenc to new AEAD interface")
      Signed-off-by: NHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      2fdea258
    • H
      crypto: caam - fix echainiv(authenc) encrypt shared descriptor · 1d2d87e8
      Horia Geantă 提交于
      There are a few things missed by the conversion to the
      new AEAD interface:
      
      1 - echainiv(authenc) encrypt shared descriptor
      
      The shared descriptor is incorrect: due to the order of operations,
      at some point in time MATH3 register is being overwritten.
      
      2 - buffer used for echainiv(authenc) encrypt shared descriptor
      
      Encrypt and givencrypt shared descriptors (for AEAD ops) are mutually
      exclusive and thus use the same buffer in context state: sh_desc_enc.
      
      However, there's one place missed by s/sh_desc_givenc/sh_desc_enc,
      leading to errors when echainiv(authenc(...)) algorithms are used:
      DECO: desc idx 14: Header Error. Invalid length or parity, or
      certain other problems.
      
      While here, also fix a typo: dma_mapping_error() is checking
      for validity of sh_desc_givenc_dma instead of sh_desc_enc_dma.
      
      Cc: <stable@vger.kernel.org> # 4.3+
      Fixes: 479bcc7c ("crypto: caam - Convert authenc to new AEAD interface")
      Signed-off-by: NHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      1d2d87e8
  9. 05 7月, 2016 1 次提交
  10. 20 6月, 2016 2 次提交
  11. 31 5月, 2016 3 次提交
  12. 28 5月, 2016 1 次提交
    • A
      remove lots of IS_ERR_VALUE abuses · 287980e4
      Arnd Bergmann 提交于
      Most users of IS_ERR_VALUE() in the kernel are wrong, as they
      pass an 'int' into a function that takes an 'unsigned long'
      argument. This happens to work because the type is sign-extended
      on 64-bit architectures before it gets converted into an
      unsigned type.
      
      However, anything that passes an 'unsigned short' or 'unsigned int'
      argument into IS_ERR_VALUE() is guaranteed to be broken, as are
      8-bit integers and types that are wider than 'unsigned long'.
      
      Andrzej Hajda has already fixed a lot of the worst abusers that
      were causing actual bugs, but it would be nice to prevent any
      users that are not passing 'unsigned long' arguments.
      
      This patch changes all users of IS_ERR_VALUE() that I could find
      on 32-bit ARM randconfig builds and x86 allmodconfig. For the
      moment, this doesn't change the definition of IS_ERR_VALUE()
      because there are probably still architecture specific users
      elsewhere.
      
      Almost all the warnings I got are for files that are better off
      using 'if (err)' or 'if (err < 0)'.
      The only legitimate user I could find that we get a warning for
      is the (32-bit only) freescale fman driver, so I did not remove
      the IS_ERR_VALUE() there but changed the type to 'unsigned long'.
      For 9pfs, I just worked around one user whose calling conventions
      are so obscure that I did not dare change the behavior.
      
      I was using this definition for testing:
      
       #define IS_ERR_VALUE(x) ((unsigned long*)NULL == (typeof (x)*)NULL && \
             unlikely((unsigned long long)(x) >= (unsigned long long)(typeof(x))-MAX_ERRNO))
      
      which ends up making all 16-bit or wider types work correctly with
      the most plausible interpretation of what IS_ERR_VALUE() was supposed
      to return according to its users, but also causes a compile-time
      warning for any users that do not pass an 'unsigned long' argument.
      
      I suggested this approach earlier this year, but back then we ended
      up deciding to just fix the users that are obviously broken. After
      the initial warning that caused me to get involved in the discussion
      (fs/gfs2/dir.c) showed up again in the mainline kernel, Linus
      asked me to send the whole thing again.
      
      [ Updated the 9p parts as per Al Viro  - Linus ]
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Andrzej Hajda <a.hajda@samsung.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: https://lkml.org/lkml/2016/1/7/363
      Link: https://lkml.org/lkml/2016/5/27/486
      Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> # For nvmem part
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      287980e4
  13. 10 5月, 2016 1 次提交
    • C
      crypto: caam - fix caam_jr_alloc() ret code · e930c765
      Catalin Vasile 提交于
      caam_jr_alloc() used to return NULL if a JR device could not be
      allocated for a session. In turn, every user of this function used
      IS_ERR() function to verify if anything went wrong, which does NOT look
      for NULL values. This made the kernel crash if the sanity check failed,
      because the driver continued to think it had allocated a valid JR dev
      instance to the session and at some point it tries to do a caam_jr_free()
      on a NULL JR dev pointer.
      This patch is a fix for this issue.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NCatalin Vasile <cata.vasile@nxp.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      e930c765
  14. 17 2月, 2016 1 次提交
  15. 25 1月, 2016 2 次提交