<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/dma-buf/heaps, branch v5.10.257</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.10.257</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.10.257'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-10-17T13:07:34+00:00</updated>
<entry>
<title>dma-buf: heaps: Fix off-by-one in CMA heap fault handler</title>
<updated>2024-10-17T13:07:34+00:00</updated>
<author>
<name>T.J. Mercier</name>
<email>tjmercier@google.com</email>
</author>
<published>2024-08-30T19:26:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=007180fcb6cc4a93211d4cc45fef3f5ccccd56ae'/>
<id>urn:sha1:007180fcb6cc4a93211d4cc45fef3f5ccccd56ae</id>
<content type='text'>
commit ea5ff5d351b520524019f7ff7f9ce418de2dad87 upstream.

Until VM_DONTEXPAND was added in commit 1c1914d6e8c6 ("dma-buf: heaps:
Don't track CMA dma-buf pages under RssFile") it was possible to obtain
a mapping larger than the buffer size via mremap and bypass the overflow
check in dma_buf_mmap_internal. When using such a mapping to attempt to
fault past the end of the buffer, the CMA heap fault handler also checks
the fault offset against the buffer size, but gets the boundary wrong by
1. Fix the boundary check so that we don't read off the end of the pages
array and insert an arbitrary page in the mapping.

Reported-by: Xingyu Jin &lt;xingyuj@google.com&gt;
Fixes: a5d2d29e24be ("dma-buf: heaps: Move heap-helper logic into the cma_heap implementation")
Cc: stable@vger.kernel.org # Applicable &gt;= 5.10. Needs adjustments only for 5.10.
Signed-off-by: T.J. Mercier &lt;tjmercier@google.com&gt;
Acked-by: John Stultz &lt;jstultz@google.com&gt;
Signed-off-by: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20240830192627.2546033-1-tjmercier@google.com
[ TJ: Backport to 5.10. On this kernel the bug is located in
  dma_heap_vm_fault which is used by both the CMA and system heaps. ]
Signed-off-by: T.J. Mercier &lt;tjmercier@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'dma-mapping-5.10' of git://git.infradead.org/users/hch/dma-mapping</title>
<updated>2020-10-15T21:43:29+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-10-15T21:43:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5a32c3413d3340f90c82c84b375ad4b335a59f28'/>
<id>urn:sha1:5a32c3413d3340f90c82c84b375ad4b335a59f28</id>
<content type='text'>
Pull dma-mapping updates from Christoph Hellwig:

 - rework the non-coherent DMA allocator

 - move private definitions out of &lt;linux/dma-mapping.h&gt;

 - lower CMA_ALIGNMENT (Paul Cercueil)

 - remove the omap1 dma address translation in favor of the common code

 - make dma-direct aware of multiple dma offset ranges (Jim Quinlan)

 - support per-node DMA CMA areas (Barry Song)

 - increase the default seg boundary limit (Nicolin Chen)

 - misc fixes (Robin Murphy, Thomas Tai, Xu Wang)

 - various cleanups

* tag 'dma-mapping-5.10' of git://git.infradead.org/users/hch/dma-mapping: (63 commits)
  ARM/ixp4xx: add a missing include of dma-map-ops.h
  dma-direct: simplify the DMA_ATTR_NO_KERNEL_MAPPING handling
  dma-direct: factor out a dma_direct_alloc_from_pool helper
  dma-direct check for highmem pages in dma_direct_alloc_pages
  dma-mapping: merge &lt;linux/dma-noncoherent.h&gt; into &lt;linux/dma-map-ops.h&gt;
  dma-mapping: move large parts of &lt;linux/dma-direct.h&gt; to kernel/dma
  dma-mapping: move dma-debug.h to kernel/dma/
  dma-mapping: remove &lt;asm/dma-contiguous.h&gt;
  dma-mapping: merge &lt;linux/dma-contiguous.h&gt; into &lt;linux/dma-map-ops.h&gt;
  dma-contiguous: remove dma_contiguous_set_default
  dma-contiguous: remove dev_set_cma_area
  dma-contiguous: remove dma_declare_contiguous
  dma-mapping: split &lt;linux/dma-mapping.h&gt;
  cma: decrease CMA_ALIGNMENT lower limit to 2
  firewire-ohci: use dma_alloc_pages
  dma-iommu: implement -&gt;alloc_noncoherent
  dma-mapping: add new {alloc,free}_noncoherent dma_map_ops methods
  dma-mapping: add a new dma_alloc_pages API
  dma-mapping: remove dma_cache_sync
  53c700: convert to dma_alloc_noncoherent
  ...
</content>
</entry>
<entry>
<title>dma-mapping: merge &lt;linux/dma-contiguous.h&gt; into &lt;linux/dma-map-ops.h&gt;</title>
<updated>2020-10-06T05:07:04+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-09-11T08:56:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0b1abd1fb7efafc25231c54a67c6fbb3d3127efd'/>
<id>urn:sha1:0b1abd1fb7efafc25231c54a67c6fbb3d3127efd</id>
<content type='text'>
Merge dma-contiguous.h into dma-map-ops.h, after removing the comment
describing the contiguous allocator into kernel/dma/contigous.c.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dmabuf: fix common struct sg_table related issues</title>
<updated>2020-09-10T06:18:35+00:00</updated>
<author>
<name>Marek Szyprowski</name>
<email>m.szyprowski@samsung.com</email>
</author>
<published>2020-04-06T14:41:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=62296b395a512930686666089ad285b1f78fd2f0'/>
<id>urn:sha1:62296b395a512930686666089ad285b1f78fd2f0</id>
<content type='text'>
The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function
returns the number of the created entries in the DMA address space.
However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and
dma_unmap_sg must be called with the original number of the entries
passed to the dma_map_sg().

struct sg_table is a common structure used for describing a non-contiguous
memory buffer, used commonly in the DRM and graphics subsystems. It
consists of a scatterlist with memory pages and DMA addresses (sgl entry),
as well as the number of scatterlist entries: CPU pages (orig_nents entry)
and DMA mapped pages (nents entry).

It turned out that it was a common mistake to misuse nents and orig_nents
entries, calling DMA-mapping functions with a wrong number of entries or
ignoring the number of mapped entries returned by the dma_map_sg()
function.

To avoid such issues, lets use a common dma-mapping wrappers operating
directly on the struct sg_table objects and use scatterlist page
iterators where possible. This, almost always, hides references to the
nents and orig_nents entries, making the code robust, easier to follow
and copy/paste safe.

Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Acked-by: Gerd Hoffmann &lt;kraxel@redhat.com&gt;
</content>
</entry>
<entry>
<title>dma-buf: heaps: Remove redundant heap identifier from system heap name</title>
<updated>2019-12-17T16:07:40+00:00</updated>
<author>
<name>Andrew F. Davis</name>
<email>afd@ti.com</email>
</author>
<published>2019-12-16T13:34:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=263e38f82cbb35bf59727a2375099482dc3331da'/>
<id>urn:sha1:263e38f82cbb35bf59727a2375099482dc3331da</id>
<content type='text'>
The heaps are already in a directory of heaps, adding _heap to a heap
name is redundant. This patch is only a name change, no logic is changed.

Signed-off-by: Andrew F. Davis &lt;afd@ti.com&gt;
Acked-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191216133405.1001-3-afd@ti.com
</content>
</entry>
<entry>
<title>dma-buf: heaps: Add CMA heap to dmabuf heaps</title>
<updated>2019-12-11T05:43:37+00:00</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2019-12-03T17:26:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b61614ec318aae0c77ecd2816878d851dd61d9a6'/>
<id>urn:sha1:b61614ec318aae0c77ecd2816878d851dd61d9a6</id>
<content type='text'>
This adds a CMA heap, which allows userspace to allocate
a dma-buf of contiguous memory out of a CMA region.

This code is an evolution of the Android ION implementation, so
thanks to its original author and maintainters:
  Benjamin Gaignard, Laura Abbott, and others!

NOTE: This patch only adds the default CMA heap. We will enable
selectively adding other CMA memory regions to the dmabuf heaps
interface with a later patch (which requires a dt binding)

Cc: Laura Abbott &lt;labbott@redhat.com&gt;
Cc: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: Liam Mark &lt;lmark@codeaurora.org&gt;
Cc: Pratik Patel &lt;pratikp@codeaurora.org&gt;
Cc: Brian Starkey &lt;Brian.Starkey@arm.com&gt;
Cc: Vincent Donnefort &lt;Vincent.Donnefort@arm.com&gt;
Cc: Sudipto Paul &lt;Sudipto.Paul@arm.com&gt;
Cc: Andrew F. Davis &lt;afd@ti.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Chenbo Feng &lt;fengc@google.com&gt;
Cc: Alistair Strachan &lt;astrachan@google.com&gt;
Cc: Hridya Valsaraju &lt;hridya@google.com&gt;
Cc: Sandeep Patil &lt;sspatil@google.com&gt;
Cc: Hillf Danton &lt;hdanton@sina.com&gt;
Cc: Dave Airlie &lt;airlied@gmail.com&gt;
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Reviewed-by: Brian Starkey &lt;brian.starkey@arm.com&gt;
Acked-by: Sandeep Patil &lt;sspatil@android.com&gt;
Acked-by: Laura Abbott &lt;labbott@redhat.com&gt;
Tested-by: Ayan Kumar Halder &lt;ayan.halder@arm.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-5-john.stultz@linaro.org
</content>
</entry>
<entry>
<title>dma-buf: heaps: Add system heap to dmabuf heaps</title>
<updated>2019-12-11T05:43:36+00:00</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2019-12-03T17:26:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=efa04fefebbd724ffda7f49e42d057a7217c45b0'/>
<id>urn:sha1:efa04fefebbd724ffda7f49e42d057a7217c45b0</id>
<content type='text'>
This patch adds system heap to the dma-buf heaps framework.

This allows applications to get a page-allocator backed dma-buf
for non-contiguous memory.

This code is an evolution of the Android ION implementation, so
thanks to its original authors and maintainters:
  Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others!

Cc: Laura Abbott &lt;labbott@redhat.com&gt;
Cc: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: Liam Mark &lt;lmark@codeaurora.org&gt;
Cc: Pratik Patel &lt;pratikp@codeaurora.org&gt;
Cc: Brian Starkey &lt;Brian.Starkey@arm.com&gt;
Cc: Vincent Donnefort &lt;Vincent.Donnefort@arm.com&gt;
Cc: Sudipto Paul &lt;Sudipto.Paul@arm.com&gt;
Cc: Andrew F. Davis &lt;afd@ti.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Chenbo Feng &lt;fengc@google.com&gt;
Cc: Alistair Strachan &lt;astrachan@google.com&gt;
Cc: Hridya Valsaraju &lt;hridya@google.com&gt;
Cc: Sandeep Patil &lt;sspatil@google.com&gt;
Cc: Hillf Danton &lt;hdanton@sina.com&gt;
Cc: Dave Airlie &lt;airlied@gmail.com&gt;
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Reviewed-by: Brian Starkey &lt;brian.starkey@arm.com&gt;
Acked-by: Sandeep Patil &lt;sspatil@android.com&gt;
Acked-by: Laura Abbott &lt;labbott@redhat.com&gt;
Tested-by: Ayan Kumar Halder &lt;ayan.halder@arm.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-4-john.stultz@linaro.org
</content>
</entry>
<entry>
<title>dma-buf: heaps: Add heap helpers</title>
<updated>2019-12-11T05:43:35+00:00</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2019-12-03T17:26:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5248eb12fea890a03b4cdc3ef546d6319d4d9b73'/>
<id>urn:sha1:5248eb12fea890a03b4cdc3ef546d6319d4d9b73</id>
<content type='text'>
Add generic helper dmabuf ops for dma heaps, so we can reduce
the amount of duplicative code for the exported dmabufs.

This code is an evolution of the Android ION implementation, so
thanks to its original authors and maintainters:
  Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others!

Cc: Laura Abbott &lt;labbott@redhat.com&gt;
Cc: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: Liam Mark &lt;lmark@codeaurora.org&gt;
Cc: Pratik Patel &lt;pratikp@codeaurora.org&gt;
Cc: Brian Starkey &lt;Brian.Starkey@arm.com&gt;
Cc: Vincent Donnefort &lt;Vincent.Donnefort@arm.com&gt;
Cc: Sudipto Paul &lt;Sudipto.Paul@arm.com&gt;
Cc: Andrew F. Davis &lt;afd@ti.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Chenbo Feng &lt;fengc@google.com&gt;
Cc: Alistair Strachan &lt;astrachan@google.com&gt;
Cc: Hridya Valsaraju &lt;hridya@google.com&gt;
Cc: Sandeep Patil &lt;sspatil@google.com&gt;
Cc: Hillf Danton &lt;hdanton@sina.com&gt;
Cc: Dave Airlie &lt;airlied@gmail.com&gt;
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Reviewed-by: Brian Starkey &lt;brian.starkey@arm.com&gt;
Acked-by: Sandeep Patil &lt;sspatil@android.com&gt;
Acked-by: Laura Abbott &lt;labbott@redhat.com&gt;
Tested-by: Ayan Kumar Halder &lt;ayan.halder@arm.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-3-john.stultz@linaro.org
</content>
</entry>
<entry>
<title>Revert "dma-buf: heaps: Add heap helpers"</title>
<updated>2019-10-30T20:41:43+00:00</updated>
<author>
<name>Sean Paul</name>
<email>seanpaul@chromium.org</email>
</author>
<published>2019-10-30T20:29:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=837324d435542ef7c6d4545b48d52833a3c0c5d3'/>
<id>urn:sha1:837324d435542ef7c6d4545b48d52833a3c0c5d3</id>
<content type='text'>
This reverts commit 7b87ea704fd9606eaafa9150116536d72f5c4b1f.

This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
subsystem. Once the userspace component is reviewed and ready for merge
we can try again.

[1]- https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

Fixes: 7b87ea704fd9 ("dma-buf: heaps: Add heap helpers")
Cc: Laura Abbott &lt;labbott@redhat.com&gt;
Cc: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: Liam Mark &lt;lmark@codeaurora.org&gt;
Cc: Pratik Patel &lt;pratikp@codeaurora.org&gt;
Cc: Brian Starkey &lt;Brian.Starkey@arm.com&gt;
Cc: Vincent Donnefort &lt;Vincent.Donnefort@arm.com&gt;
Cc: Sudipto Paul &lt;Sudipto.Paul@arm.com&gt;
Cc: Andrew F. Davis &lt;afd@ti.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Chenbo Feng &lt;fengc@google.com&gt;
Cc: Alistair Strachan &lt;astrachan@google.com&gt;
Cc: Hridya Valsaraju &lt;hridya@google.com&gt;
Cc: Hillf Danton &lt;hdanton@sina.com&gt;
Cc: dri-devel@lists.freedesktop.org
Cc: Brian Starkey &lt;brian.starkey@arm.com&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: "Andrew F. Davis" &lt;afd@ti.com&gt;
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Acked-by: David Airlie &lt;airlied@linux.ie&gt;
Signed-off-by: Sean Paul &lt;sean@poorly.run&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191030203003.101156-5-sean@poorly.run
</content>
</entry>
<entry>
<title>Revert "dma-buf: heaps: Add system heap to dmabuf heaps"</title>
<updated>2019-10-30T20:41:33+00:00</updated>
<author>
<name>Sean Paul</name>
<email>seanpaul@chromium.org</email>
</author>
<published>2019-10-30T20:29:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d59c5e025081a4c1f4528010524a37ddc5a986be'/>
<id>urn:sha1:d59c5e025081a4c1f4528010524a37ddc5a986be</id>
<content type='text'>
This reverts commit 47a32f9c12266d450b92089148c6039591bd9909.

This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
subsystem. Once the userspace component is reviewed and ready for merge
we can try again.

[1]- https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

Fixes: 47a32f9c1226 ("dma-buf: heaps: Add system heap to dmabuf heaps")
Cc: Laura Abbott &lt;labbott@redhat.com&gt;
Cc: Benjamin Gaignard &lt;benjamin.gaignard@linaro.org&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: Liam Mark &lt;lmark@codeaurora.org&gt;
Cc: Pratik Patel &lt;pratikp@codeaurora.org&gt;
Cc: Brian Starkey &lt;Brian.Starkey@arm.com&gt;
Cc: Vincent Donnefort &lt;Vincent.Donnefort@arm.com&gt;
Cc: Sudipto Paul &lt;Sudipto.Paul@arm.com&gt;
Cc: Andrew F. Davis &lt;afd@ti.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Chenbo Feng &lt;fengc@google.com&gt;
Cc: Alistair Strachan &lt;astrachan@google.com&gt;
Cc: Hridya Valsaraju &lt;hridya@google.com&gt;
Cc: Hillf Danton &lt;hdanton@sina.com&gt;
Cc: dri-devel@lists.freedesktop.org
Cc: Brian Starkey &lt;brian.starkey@arm.com&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: "Andrew F. Davis" &lt;afd@ti.com&gt;
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Acked-by: David Airlie &lt;airlied@linux.ie&gt;
Signed-off-by: Sean Paul &lt;sean@poorly.run&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20191030203003.101156-4-sean@poorly.run
</content>
</entry>
</feed>
