<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/dma-buf/dma-buf.c, branch linux-5.12.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.12.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.12.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-05-26T10:59:10Z</updated>
<entry>
<title>dma-buf: fix unintended pin/unpin warnings</title>
<updated>2021-05-26T10:59:10Z</updated>
<author>
<name>Christian König</name>
</author>
<published>2021-05-17T11:20:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9396bad5103f9966e021147c38a004a44003b216'/>
<id>urn:sha1:9396bad5103f9966e021147c38a004a44003b216</id>
<content type='text'>
commit 7e008b02557ccece4d2c31fb0eaf6243cbc87121 upstream.

DMA-buf internal users call the pin/unpin functions without having a
dynamic attachment. Avoid the warning and backtrace in the logs.

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Bugs: https://gitlab.freedesktop.org/drm/intel/-/issues/3481
Fixes: c545781e1c55 ("dma-buf: doc polish for pin/unpin")
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
CC: stable@kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20210517115705.2141-1-christian.koenig@amd.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'v5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into drm-next</title>
<updated>2021-01-25T04:35:44Z</updated>
<author>
<name>Dave Airlie</name>
</author>
<published>2021-01-25T04:35:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bc96ad6722f86a377ed2872c9a4854c90caf78ca'/>
<id>urn:sha1:bc96ad6722f86a377ed2872c9a4854c90caf78ca</id>
<content type='text'>
Backmerge v5.11-rc5 into drm-next to clean up a bunch of conflicts we are dragging around.

Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
</entry>
<entry>
<title>dma-buf: Add debug option</title>
<updated>2021-01-18T13:26:51Z</updated>
<author>
<name>Daniel Vetter</name>
</author>
<published>2021-01-15T16:47:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=84335675f2223cbd25d0de7d38ecc7d40b95bd4a'/>
<id>urn:sha1:84335675f2223cbd25d0de7d38ecc7d40b95bd4a</id>
<content type='text'>
We have too many people abusing the struct page they can get at but
really shouldn't in importers. Aside from that the backing page might
simply not exist (for dynamic p2p mappings) looking at it and using it
e.g. for mmap can also wreak the page handling of the exporter
completely. Importers really must go through the proper interface like
dma_buf_mmap for everything.

I'm semi-tempted to enforce this for dynamic importers since those
really have no excuse at all to break the rules.

Unfortuantely we can't store the right pointers somewhere safe to make
sure we oops on something recognizable, so best is to just wrangle
them a bit by flipping all the bits. At least on x86 kernel addresses
have all their high bits sets and the struct page array is fairly low
in the kernel mapping, so flipping all the bits gives us a very high
pointer in userspace and hence excellent chances for an invalid
dereference.

v2: Add a note to the @map_dma_buf hook that exporters shouldn't do
fancy caching tricks, which would blow up with this address scrambling
trick here (Chris)

Enable by default when CONFIG_DMA_API_DEBUG is enabled.

v3: Only one copy of the mangle/unmangle code (Christian)

v4: #ifdef, not #if (0day)

v5: sg_table can also be an ERR_PTR (Chris, Christian)

Reviewed-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@intel.com&gt;
Cc: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: "Christian König" &lt;christian.koenig@amd.com&gt;
Cc: David Stevens &lt;stevensd@chromium.org&gt;
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Link: https://patchwork.freedesktop.org/patch/msgid/20210115164739.3958206-1-daniel.vetter@ffwll.ch
</content>
</entry>
<entry>
<title>dmabuf: fix use-after-free of dmabuf's file-&gt;f_inode</title>
<updated>2021-01-07T12:40:30Z</updated>
<author>
<name>Charan Teja Reddy</name>
</author>
<published>2021-01-05T14:36:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=05cd84691eafcd7959a1e120d5e72c0dd98c5d91'/>
<id>urn:sha1:05cd84691eafcd7959a1e120d5e72c0dd98c5d91</id>
<content type='text'>
It is observed 'use-after-free' on the dmabuf's file-&gt;f_inode with the
race between closing the dmabuf file and reading the dmabuf's debug
info.

Consider the below scenario where P1 is closing the dma_buf file
and P2 is reading the dma_buf's debug info in the system:

P1						P2
					dma_buf_debug_show()
dma_buf_put()
  __fput()
    file-&gt;f_op-&gt;release()
    dput()
    ....
      dentry_unlink_inode()
        iput(dentry-&gt;d_inode)
        (where the inode is freed)
					mutex_lock(&amp;db_list.lock)
					read 'dma_buf-&gt;file-&gt;f_inode'
					(the same inode is freed by P1)
					mutex_unlock(&amp;db_list.lock)
      dentry-&gt;d_op-&gt;d_release()--&gt;
        dma_buf_release()
          .....
          mutex_lock(&amp;db_list.lock)
          removes the dmabuf from the list
          mutex_unlock(&amp;db_list.lock)

In the above scenario, when dma_buf_put() is called on a dma_buf, it
first frees the dma_buf's file-&gt;f_inode(=dentry-&gt;d_inode) and then
removes this dma_buf from the system db_list. In between P2 traversing
the db_list tries to access this dma_buf's file-&gt;f_inode that was freed
by P1 which is a use-after-free case.

Since, __fput() calls f_op-&gt;release first and then later calls the
d_op-&gt;d_release, move the dma_buf's db_list removal from d_release() to
f_op-&gt;release(). This ensures that dma_buf's file-&gt;f_inode is not
accessed after it is released.

Cc: &lt;stable@vger.kernel.org&gt; # 5.4.x-
Fixes: 4ab59c3c638c ("dma-buf: Move dma_buf_release() from fops to dentry_ops")
Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Charan Teja Reddy &lt;charante@codeaurora.org&gt;
Signed-off-by: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Signed-off-by: Thomas Zimmermann &lt;tzimmermann@suse.de&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/1609857399-31549-1-git-send-email-charante@codeaurora.org
</content>
</entry>
<entry>
<title>dma-buf: doc polish for pin/unpin</title>
<updated>2020-12-16T10:28:34Z</updated>
<author>
<name>Daniel Vetter</name>
</author>
<published>2020-12-11T15:58:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c545781e1c55ab680dcc49c37212d5327b9d6812'/>
<id>urn:sha1:c545781e1c55ab680dcc49c37212d5327b9d6812</id>
<content type='text'>
Motivated by a discussion with Christian and Thomas: Try to untangle a
bit what's relevant for importers and what's relevant for exporters.

Also add an assert that really only dynamic importers use the api
function, anything else doesn't make sense.

Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@intel.com&gt;
Cc: Thomas Zimmermann &lt;tzimmermann@suse.de&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: "Christian König" &lt;christian.koenig@amd.com&gt;
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Link: https://patchwork.freedesktop.org/patch/msgid/20201211155843.3348718-4-daniel.vetter@ffwll.ch
</content>
</entry>
<entry>
<title>dma-buf: begin/end_cpu might lock the dma_resv lock</title>
<updated>2020-12-16T10:28:34Z</updated>
<author>
<name>Daniel Vetter</name>
</author>
<published>2020-12-14T17:16:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8ccf0a29af75326fb8e5ed6e51ff61e74b7ed2e4'/>
<id>urn:sha1:8ccf0a29af75326fb8e5ed6e51ff61e74b7ed2e4</id>
<content type='text'>
At least amdgpu and i915 do, so lets just document this as the rule.

v2: Works better with less typos (intel-gfx-ci)

Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@intel.com&gt;
Cc: Thomas Zimmermann &lt;tzimmermann@suse.de&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: "Christian König" &lt;christian.koenig@amd.com&gt;
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Link: https://patchwork.freedesktop.org/patch/msgid/20201214171622.3868883-1-daniel.vetter@ffwll.ch
</content>
</entry>
<entry>
<title>dma-buf: some kerneldoc formatting fixes</title>
<updated>2020-12-16T10:28:34Z</updated>
<author>
<name>Daniel Vetter</name>
</author>
<published>2020-12-11T15:58:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=85804b70cca68d77bca419b493ab843bf710de68'/>
<id>urn:sha1:85804b70cca68d77bca419b493ab843bf710de68</id>
<content type='text'>
Noticed while reviewing the output. Adds a bunch more links and fixes
the function interface quoting.

Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@intel.com&gt;
Cc: Thomas Zimmermann &lt;tzimmermann@suse.de&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: "Christian König" &lt;christian.koenig@amd.com&gt;
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Link: https://patchwork.freedesktop.org/patch/msgid/20201211155843.3348718-2-daniel.vetter@ffwll.ch
</content>
</entry>
<entry>
<title>dma-buf: Remove kmap kerneldoc vestiges</title>
<updated>2020-12-16T10:28:34Z</updated>
<author>
<name>Daniel Vetter</name>
</author>
<published>2020-12-11T15:58:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=de9114ece5dfcc422164a24a687785843ed92c47'/>
<id>urn:sha1:de9114ece5dfcc422164a24a687785843ed92c47</id>
<content type='text'>
Also try to clarify a bit when dma_buf_begin/end_cpu_access should
be called.

Acked-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@intel.com&gt;
Cc: Thomas Zimmermann &lt;tzimmermann@suse.de&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: "Christian König" &lt;christian.koenig@amd.com&gt;
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Link: https://patchwork.freedesktop.org/patch/msgid/20201211155843.3348718-1-daniel.vetter@ffwll.ch
</content>
</entry>
<entry>
<title>mm: introduce vma_set_file function v5</title>
<updated>2020-11-19T09:36:36Z</updated>
<author>
<name>Christian König</name>
</author>
<published>2020-09-14T13:09:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=295992fb815e791d14b18ef7cdbbaf1a76211a31'/>
<id>urn:sha1:295992fb815e791d14b18ef7cdbbaf1a76211a31</id>
<content type='text'>
Add the new vma_set_file() function to allow changing
vma-&gt;vm_file with the necessary refcount dance.

v2: add more users of this.
v3: add missing EXPORT_SYMBOL, rebase on mmap cleanup,
    add comments why we drop the reference on two occasions.
v4: make it clear that changing an anonymous vma is illegal.
v5: move vma_set_file to mm/util.c

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt; (v2)
Reviewed-by: Jason Gunthorpe &lt;jgg@nvidia.com&gt;
Acked-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Link: https://patchwork.freedesktop.org/patch/399360/
</content>
</entry>
<entry>
<title>mm: mmap: fix fput in error path v2</title>
<updated>2020-11-19T09:35:58Z</updated>
<author>
<name>Christian König</name>
</author>
<published>2020-10-09T13:08:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1527f926fd04490f648c42f42b45218a04754f87'/>
<id>urn:sha1:1527f926fd04490f648c42f42b45218a04754f87</id>
<content type='text'>
Patch "495c10cc1c0c CHROMIUM: dma-buf: restore args..."
adds a workaround for a bug in mmap_region.

As the comment states -&gt;mmap() callback can change
vma-&gt;vm_file and so we might call fput() on the wrong file.

Revert the workaround and proper fix this in mmap_region.

v2: drop the extra if in dma_buf_mmap as well

Signed-off-by: Christian König &lt;christian.koenig@amd.com&gt;
Reviewed-by: Jason Gunthorpe &lt;jgg@nvidia.com&gt;
Acked-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Link: https://patchwork.freedesktop.org/patch/399359/
</content>
</entry>
</feed>
