<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/tee/tee_shm.c, branch linux-4.16.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-4.16.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-4.16.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2018-05-22T16:56:21+00:00</updated>
<entry>
<title>tee: shm: fix use-after-free via temporarily dropped reference</title>
<updated>2018-05-22T16:56:21+00:00</updated>
<author>
<name>Jann Horn</name>
<email>jannh@google.com</email>
</author>
<published>2018-04-04T19:03:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3c079e40eea50b3f2168648922e80bc942c81cce'/>
<id>urn:sha1:3c079e40eea50b3f2168648922e80bc942c81cce</id>
<content type='text'>
commit bb765d1c331f62b59049d35607ed2e365802bef9 upstream.

Bump the file's refcount before moving the reference into the fd table,
not afterwards. The old code could drop the file's refcount to zero for a
short moment before calling get_file() via get_dma_buf().

This code can only be triggered on ARM systems that use Linaro's OP-TEE.

Fixes: 967c9cca2cc5 ("tee: generic TEE subsystem")
Signed-off-by: Jann Horn &lt;jannh@google.com&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>tee: shm: Potential NULL dereference calling tee_shm_register()</title>
<updated>2018-01-09T13:34:00+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2018-01-06T09:22:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2490cdf6435b1d3cac0dbf710cd752487c67c296'/>
<id>urn:sha1:2490cdf6435b1d3cac0dbf710cd752487c67c296</id>
<content type='text'>
get_user_pages_fast() can return zero in certain error paths.  We should
handle that or else it means we accidentally return ERR_PTR(0) which is
NULL instead of an error pointer.  The callers are not expecting that
and will crash with a NULL dereference.

Fixes: 033ddf12bcf5 ("tee: add register user memory")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
</content>
</entry>
<entry>
<title>tee: shm: don't put_page on null shm-&gt;pages</title>
<updated>2017-12-28T21:20:10+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2017-12-22T17:51:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c94f31b526fe658c25dd2d07c90486a85437f01c'/>
<id>urn:sha1:c94f31b526fe658c25dd2d07c90486a85437f01c</id>
<content type='text'>
In the case that shm-&gt;pages fails to allocate, the current exit
error path will try to put_page on a null shm-&gt;pages and cause
a null pointer dereference when accessing shm-&gt;pages[n]. Fix this
by only performing the put_page and kfree on shm-&gt;pages if it
is not null.

Detected by CoverityScan, CID#1463283 ("Dereference after null check")

Fixes: 033ddf12bcf5 ("tee: add register user memory")
Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
</content>
</entry>
<entry>
<title>tee: shm: make function __tee_shm_alloc static</title>
<updated>2017-12-28T21:19:57+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2017-12-22T17:01:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=80ec6f5de60b6934f145b2f7e5369592bcab85f3'/>
<id>urn:sha1:80ec6f5de60b6934f145b2f7e5369592bcab85f3</id>
<content type='text'>
The function __tee_shm_alloc is local to the source and does
not need to be in global scope, so make it static.

Cleans up sparse warning:
symbol '__tee_shm_alloc' was not declared. Should it be static?

Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
</content>
</entry>
<entry>
<title>tee: add start argument to shm_register callback</title>
<updated>2017-12-28T09:08:00+00:00</updated>
<author>
<name>Jens Wiklander</name>
<email>jens.wiklander@linaro.org</email>
</author>
<published>2017-12-28T09:08:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=95ffe4ca43877eea176d7e95aa0d38bbdc3d2903'/>
<id>urn:sha1:95ffe4ca43877eea176d7e95aa0d38bbdc3d2903</id>
<content type='text'>
Adds a start argument to the shm_register callback to allow the callback
to check memory type of the passed pages.

Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
</content>
</entry>
<entry>
<title>tee: shm: inline tee_shm_get_id()</title>
<updated>2017-12-15T12:36:21+00:00</updated>
<author>
<name>Volodymyr Babchuk</name>
<email>vlad.babchuk@gmail.com</email>
</author>
<published>2017-11-29T12:48:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ef8e08d24ca84846ce639b835ebd2f15a943f42b'/>
<id>urn:sha1:ef8e08d24ca84846ce639b835ebd2f15a943f42b</id>
<content type='text'>
Now, when struct tee_shm is defined in public header,
we can inline small getter functions like this one.

Signed-off-by: Volodymyr Babchuk &lt;vlad.babchuk@gmail.com&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
</content>
</entry>
<entry>
<title>tee: use reference counting for tee_context</title>
<updated>2017-12-15T12:36:18+00:00</updated>
<author>
<name>Volodymyr Babchuk</name>
<email>vlad.babchuk@gmail.com</email>
</author>
<published>2017-11-29T12:48:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=217e0250cccb9e54d457991446cd3fab413085e1'/>
<id>urn:sha1:217e0250cccb9e54d457991446cd3fab413085e1</id>
<content type='text'>
We need to ensure that tee_context is present until last
shared buffer will be freed.

Signed-off-by: Volodymyr Babchuk &lt;vlad.babchuk@gmail.com&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
</content>
</entry>
<entry>
<title>tee: add register user memory</title>
<updated>2017-12-15T12:32:20+00:00</updated>
<author>
<name>Jens Wiklander</name>
<email>jens.wiklander@linaro.org</email>
</author>
<published>2017-11-29T12:48:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=033ddf12bcf5326b93bd604f50a7474a434a35f9'/>
<id>urn:sha1:033ddf12bcf5326b93bd604f50a7474a434a35f9</id>
<content type='text'>
Added new ioctl to allow users register own buffers as a shared memory.

Signed-off-by: Volodymyr Babchuk &lt;vlad.babchuk@gmail.com&gt;
[jw: moved tee_shm_is_registered() declaration]
[jw: added space after __tee_shm_alloc() implementation]
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
</content>
</entry>
<entry>
<title>tee: flexible shared memory pool creation</title>
<updated>2017-12-15T11:37:29+00:00</updated>
<author>
<name>Jens Wiklander</name>
<email>jens.wiklander@linaro.org</email>
</author>
<published>2017-11-29T12:48:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e2aca5d8928acb9cc9a87802b02102d4f9b9b596'/>
<id>urn:sha1:e2aca5d8928acb9cc9a87802b02102d4f9b9b596</id>
<content type='text'>
Makes creation of shm pools more flexible by adding new more primitive
functions to allocate a shm pool. This makes it easier to add driver
specific shm pool management.

Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
Signed-off-by: Volodymyr Babchuk &lt;vlad.babchuk@gmail.com&gt;
</content>
</entry>
<entry>
<title>tee: tee_shm: Constify dma_buf_ops structures.</title>
<updated>2017-08-04T08:30:27+00:00</updated>
<author>
<name>Arvind Yadav</name>
<email>arvind.yadav.cs@gmail.com</email>
</author>
<published>2017-07-01T12:26:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=53e3ca5cee24f5fafe4e9ff5fe4b230e1a1b85ed'/>
<id>urn:sha1:53e3ca5cee24f5fafe4e9ff5fe4b230e1a1b85ed</id>
<content type='text'>
dma_buf_ops are not supposed to change at runtime. All functions
working with dma_buf_ops provided by &lt;linux/dma-buf.h&gt; work with
const dma_buf_ops. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   2026	    112	      0	   2138	    85a	drivers/tee/tee_shm.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   2138	      0	      0	   2138	    85a	drivers/tee/tee_shm.o

Signed-off-by: Arvind Yadav &lt;arvind.yadav.cs@gmail.com&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
</content>
</entry>
</feed>
