1. 18 Oct, 2021 1 commit
  2. 11 Oct, 2021 2 commits
    • Gerald Schaefer's avatar
      dma-debug: fix sg checks in debug_dma_map_sg() · 293d92cb
      Gerald Schaefer authored
      The following warning occurred sporadically on s390:
      DMA-API: nvme 0006:00:00.0: device driver maps memory from kernel text or rodata [addr=0000000048cc5e2f] [len=131072]
      WARNING: CPU: 4 PID: 825 at kernel/dma/debug.c:1083 check_for_illegal_area+0xa8/0x138
      
      It is a false-positive warning, due to broken logic in debug_dma_map_sg().
      check_for_illegal_area() checks for overlay of sg elements with kernel text
      or rodata. It is called with sg_dma_len(s) instead of s->length as
      parameter. After the call to ->map_sg(), sg_dma_len() will contain the
      length of possibly combined sg elements in the DMA address space, and not
      the individual sg element length, which would be s->length.
      
      The check will then use the physical start address of an sg element, and
      add the DMA length for the overlap check, which could result in the false
      warning, because the DMA length can be larger than the actual single sg
      element length.
      
      In addition, the call to check_for_illegal_area() happens in the iteration
      over mapped_ents, which will not include all individual sg elements if
      any of them were combined in ->map_sg().
      
      Fix this by using s->length instead of sg_dma_len(s). Also put the call to
      check_for_illegal_area() in a separate loop, iterating over all the
      individual sg elements ("nents" instead of "mapped_ents").
      
      While at it, as suggested by Robin Murphy, also move check_for_stack()
      inside the new loop, as it is similarly concerned with validating the
      individual sg elements.
      
      Link: https://lore.kernel.org/lkml/20210705185252.4074653-1-gerald.schaefer@linux.ibm.com
      Fixes: 884d0597 ("dma-debug: use sg_dma_len accessor")
      Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@linux.ibm.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      293d92cb
    • Logan Gunthorpe's avatar
      dma-mapping: fix the kerneldoc for dma_map_sgtable() · 011a9ce8
      Logan Gunthorpe authored
      htmldocs began producing the following warnings:
      
        kernel/dma/mapping.c:256: WARNING: Definition list ends without a
                   blank line; unexpected unindent.
        kernel/dma/mapping.c:257: WARNING: Bullet list ends without a blank
                   line; unexpected unindent.
      
      Reformatting the list without hyphens fixes the warnings and produces
      both a readable text and HTML output.
      
      Fixes: fffe3cc8 ("dma-mapping: allow map_sg() ops to return negative error code")
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      011a9ce8
  3. 14 Sep, 2021 1 commit
  4. 13 Sep, 2021 1 commit
  5. 06 Sep, 2021 1 commit
  6. 19 Aug, 2021 2 commits
  7. 18 Aug, 2021 5 commits
  8. 14 Aug, 2021 1 commit
  9. 09 Aug, 2021 23 commits
  10. 08 Aug, 2021 3 commits