<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/staging/android, branch linux-3.14.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>staging: ion: fix corruption of ion_import_dma_buf</title>
<updated>2015-10-22T21:39:19+00:00</updated>
<author>
<name>Shawn Lin</name>
<email>shawn.lin@rock-chips.com</email>
</author>
<published>2015-09-09T07:41:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4b78d69641fb02e2b412da752e2cc15e100369cf'/>
<id>4b78d69641fb02e2b412da752e2cc15e100369cf</id>
<content type='text'>
commit 6fa92e2bcf6390e64895b12761e851c452d87bd8 upstream.

we found this issue but still exit in lastest kernel. Simply
keep ion_handle_create under mutex_lock to avoid this race.

WARNING: CPU: 2 PID: 2648 at drivers/staging/android/ion/ion.c:512 ion_handle_add+0xb4/0xc0()
ion_handle_add: buffer already found.
Modules linked in: iwlmvm iwlwifi mac80211 cfg80211 compat
CPU: 2 PID: 2648 Comm: TimedEventQueue Tainted: G        W    3.14.0 #7
 00000000 00000000 9a3efd2c 80faf273 9a3efd6c 9a3efd5c 80935dc9 811d7fd3
 9a3efd88 00000a58 812208a0 00000200 80e128d4 80e128d4 8d4ae00c a8cd8600
 a8cd8094 9a3efd74 80935e0e 00000009 9a3efd6c 811d7fd3 9a3efd88 9a3efd9c
Call Trace:
  [&lt;80faf273&gt;] dump_stack+0x48/0x69
  [&lt;80935dc9&gt;] warn_slowpath_common+0x79/0x90
  [&lt;80e128d4&gt;] ? ion_handle_add+0xb4/0xc0
  [&lt;80e128d4&gt;] ? ion_handle_add+0xb4/0xc0
  [&lt;80935e0e&gt;] warn_slowpath_fmt+0x2e/0x30
  [&lt;80e128d4&gt;] ion_handle_add+0xb4/0xc0
  [&lt;80e144cc&gt;] ion_import_dma_buf+0x8c/0x110
  [&lt;80c517c4&gt;] reg_init+0x364/0x7d0
  [&lt;80993363&gt;] ? futex_wait+0x123/0x210
  [&lt;80992e0e&gt;] ? get_futex_key+0x16e/0x1e0
  [&lt;8099308f&gt;] ? futex_wake+0x5f/0x120
  [&lt;80c51e19&gt;] vpu_service_ioctl+0x1e9/0x500
  [&lt;80994aec&gt;] ? do_futex+0xec/0x8e0
  [&lt;80971080&gt;] ? prepare_to_wait_event+0xc0/0xc0
  [&lt;80c51c30&gt;] ? reg_init+0x7d0/0x7d0
  [&lt;80a22562&gt;] do_vfs_ioctl+0x2d2/0x4c0
  [&lt;80b198ad&gt;] ? inode_has_perm.isra.41+0x2d/0x40
  [&lt;80b199cf&gt;] ? file_has_perm+0x7f/0x90
  [&lt;80b1a5f7&gt;] ? selinux_file_ioctl+0x47/0xf0
  [&lt;80a227a8&gt;] SyS_ioctl+0x58/0x80
  [&lt;80fb45e8&gt;] syscall_call+0x7/0x7
  [&lt;80fb0000&gt;] ? mmc_do_calc_max_discard+0xab/0xe4

Fixes: 83271f626 ("ion: hold reference to handle...")
Signed-off-by: Shawn Lin &lt;shawn.lin@rock-chips.com&gt;
Reviewed-by: Laura Abbott &lt;labbott@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 6fa92e2bcf6390e64895b12761e851c452d87bd8 upstream.

we found this issue but still exit in lastest kernel. Simply
keep ion_handle_create under mutex_lock to avoid this race.

WARNING: CPU: 2 PID: 2648 at drivers/staging/android/ion/ion.c:512 ion_handle_add+0xb4/0xc0()
ion_handle_add: buffer already found.
Modules linked in: iwlmvm iwlwifi mac80211 cfg80211 compat
CPU: 2 PID: 2648 Comm: TimedEventQueue Tainted: G        W    3.14.0 #7
 00000000 00000000 9a3efd2c 80faf273 9a3efd6c 9a3efd5c 80935dc9 811d7fd3
 9a3efd88 00000a58 812208a0 00000200 80e128d4 80e128d4 8d4ae00c a8cd8600
 a8cd8094 9a3efd74 80935e0e 00000009 9a3efd6c 811d7fd3 9a3efd88 9a3efd9c
Call Trace:
  [&lt;80faf273&gt;] dump_stack+0x48/0x69
  [&lt;80935dc9&gt;] warn_slowpath_common+0x79/0x90
  [&lt;80e128d4&gt;] ? ion_handle_add+0xb4/0xc0
  [&lt;80e128d4&gt;] ? ion_handle_add+0xb4/0xc0
  [&lt;80935e0e&gt;] warn_slowpath_fmt+0x2e/0x30
  [&lt;80e128d4&gt;] ion_handle_add+0xb4/0xc0
  [&lt;80e144cc&gt;] ion_import_dma_buf+0x8c/0x110
  [&lt;80c517c4&gt;] reg_init+0x364/0x7d0
  [&lt;80993363&gt;] ? futex_wait+0x123/0x210
  [&lt;80992e0e&gt;] ? get_futex_key+0x16e/0x1e0
  [&lt;8099308f&gt;] ? futex_wake+0x5f/0x120
  [&lt;80c51e19&gt;] vpu_service_ioctl+0x1e9/0x500
  [&lt;80994aec&gt;] ? do_futex+0xec/0x8e0
  [&lt;80971080&gt;] ? prepare_to_wait_event+0xc0/0xc0
  [&lt;80c51c30&gt;] ? reg_init+0x7d0/0x7d0
  [&lt;80a22562&gt;] do_vfs_ioctl+0x2d2/0x4c0
  [&lt;80b198ad&gt;] ? inode_has_perm.isra.41+0x2d/0x40
  [&lt;80b199cf&gt;] ? file_has_perm+0x7f/0x90
  [&lt;80b1a5f7&gt;] ? selinux_file_ioctl+0x47/0xf0
  [&lt;80a227a8&gt;] SyS_ioctl+0x58/0x80
  [&lt;80fb45e8&gt;] syscall_call+0x7/0x7
  [&lt;80fb0000&gt;] ? mmc_do_calc_max_discard+0xab/0xe4

Fixes: 83271f626 ("ion: hold reference to handle...")
Signed-off-by: Shawn Lin &lt;shawn.lin@rock-chips.com&gt;
Reviewed-by: Laura Abbott &lt;labbott@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>staging: binder: Fix death notifications</title>
<updated>2014-02-21T20:30:54+00:00</updated>
<author>
<name>Arve Hjønnevåg</name>
<email>arve@android.com</email>
</author>
<published>2014-02-17T21:58:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e194fd8a5d8e0a7eeed239a8534460724b62fe2d'/>
<id>e194fd8a5d8e0a7eeed239a8534460724b62fe2d</id>
<content type='text'>
The change (008fa749e0fe5b2fffd20b7fe4891bb80d072c6a) that moved the
node release code to a separate function broke death notifications in
some cases. When it encountered a reference without a death
notification request, it would skip looking at the remaining
references, and therefore fail to send death notifications for them.

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt; # 3.10
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Jeremy Compostella &lt;jeremy.compostella@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The change (008fa749e0fe5b2fffd20b7fe4891bb80d072c6a) that moved the
node release code to a separate function broke death notifications in
some cases. When it encountered a reference without a death
notification request, it would skip looking at the remaining
references, and therefore fail to send death notifications for them.

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt; # 3.10
Signed-off-by: Arve Hjønnevåg &lt;arve@android.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Jeremy Compostella &lt;jeremy.compostella@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>gpu: ion: dereferencing an ERR_PTR</title>
<updated>2014-02-07T19:08:46+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2014-01-22T14:20:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=54de9af9f0d7a91e898b6e02199be16dc26a4870'/>
<id>54de9af9f0d7a91e898b6e02199be16dc26a4870</id>
<content type='text'>
We dereference "heap-&gt;task" before checking if it's an ERR_PTR.

Fixes: ea313b5f88ed ('gpu: ion: Also shrink memory cached in the deferred free list')
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We dereference "heap-&gt;task" before checking if it's an ERR_PTR.

Fixes: ea313b5f88ed ('gpu: ion: Also shrink memory cached in the deferred free list')
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>staging: android: ion: dummy: fix an error code</title>
<updated>2014-02-07T19:08:46+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2014-01-20T10:30:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=630127f36784e59e995c206c37825a36a34d346c'/>
<id>630127f36784e59e995c206c37825a36a34d346c</id>
<content type='text'>
We should be returning -ENOMEM here instead of zero.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We should be returning -ENOMEM here instead of zero.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>staging: android: sync: Signal pt before sync_timeline object gets destroyed</title>
<updated>2014-02-07T17:36:27+00:00</updated>
<author>
<name>Prakash Kamliya</name>
<email>pkamliya@codeaurora.org</email>
</author>
<published>2014-02-05T00:08:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ac5b705b22642208764aa784ccc47f093d0212b5'/>
<id>ac5b705b22642208764aa784ccc47f093d0212b5</id>
<content type='text'>
There is a race condition

Assume we have *one* sync_fence object, with *one* sync_pt
which belongs to *one* sync_timeline, given this condition,
sync_timeline-&gt;kref will have two counts, one for sync_timeline
(implicit) and another for sync_pt.

Assume following is the situation on CPU

Theead-1 : (Thread which calls sync_timeline_destroy())
  -&gt; (some function calls)
   -&gt; sync_timeline_destory()
    -&gt; sync_timeline_signal() (CPU is inside this
function after putting reference to sync_timeline)

At this time Thread-2 comes and does following

Thread-2 : (fclose on fence fd)
&gt; sync_fence_release() -&gt; because of fclose() on fence object
 -&gt; sync_fence_free()
  -&gt; sync_pt_free()
   -&gt; kref_put(&amp;pt-&gt;parent-&gt;kref, sync_timeline_free);
    -&gt; sync_timeline_free() (CPU is inside this because
this time kref will be zero after _put)

Thread-2 will free sync_timeline object before Thread-1
has finished its work inside sync_timeline_signal.

With this change we signals all sync_pt before putting
reference to sync_timeline object.

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: Prakash Kamliya &lt;pkamliya@codeaurora.org&gt;
[jstultz: minor commit subject tweak]
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is a race condition

Assume we have *one* sync_fence object, with *one* sync_pt
which belongs to *one* sync_timeline, given this condition,
sync_timeline-&gt;kref will have two counts, one for sync_timeline
(implicit) and another for sync_pt.

Assume following is the situation on CPU

Theead-1 : (Thread which calls sync_timeline_destroy())
  -&gt; (some function calls)
   -&gt; sync_timeline_destory()
    -&gt; sync_timeline_signal() (CPU is inside this
function after putting reference to sync_timeline)

At this time Thread-2 comes and does following

Thread-2 : (fclose on fence fd)
&gt; sync_fence_release() -&gt; because of fclose() on fence object
 -&gt; sync_fence_free()
  -&gt; sync_pt_free()
   -&gt; kref_put(&amp;pt-&gt;parent-&gt;kref, sync_timeline_free);
    -&gt; sync_timeline_free() (CPU is inside this because
this time kref will be zero after _put)

Thread-2 will free sync_timeline object before Thread-1
has finished its work inside sync_timeline_signal.

With this change we signals all sync_pt before putting
reference to sync_timeline object.

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: Prakash Kamliya &lt;pkamliya@codeaurora.org&gt;
[jstultz: minor commit subject tweak]
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>staging: ion: Fix build warning</title>
<updated>2014-02-07T17:03:16+00:00</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2014-02-05T00:08:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a33b2fc5a9a131eb0a82846f55d7775b28cb2fcb'/>
<id>a33b2fc5a9a131eb0a82846f55d7775b28cb2fcb</id>
<content type='text'>
Add #include &lt;linux/device.h&gt; to fix the following warning seen
with gcc 4.7.3:

In file included from drivers/staging/android/ion/ion_heap.c:26:0:
drivers/staging/android/ion/ion_priv.h:358:21: warning: ‘struct device’ declared inside parameter list [enabled by default]
drivers/staging/android/ion/ion_priv.h:358:21: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add #include &lt;linux/device.h&gt; to fix the following warning seen
with gcc 4.7.3:

In file included from drivers/staging/android/ion/ion_heap.c:26:0:
drivers/staging/android/ion/ion_priv.h:358:21: warning: ‘struct device’ declared inside parameter list [enabled by default]
drivers/staging/android/ion/ion_priv.h:358:21: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>staging: ion: Fix ION_IOC_FREE compat ioctl</title>
<updated>2014-02-07T17:03:16+00:00</updated>
<author>
<name>Laura Abbott</name>
<email>lauraa@codeaurora.org</email>
</author>
<published>2014-02-05T00:08:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=8666a87611fbd8597111c96e93a2f075664ee392'/>
<id>8666a87611fbd8597111c96e93a2f075664ee392</id>
<content type='text'>
The compat ioctl for ION_IOC_FREE currently passes allocation data
instead of the free data. Correct this.

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: Laura Abbott &lt;lauraa@codeaurora.org&gt;
[jstultz: Folded in a small build fix]
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The compat ioctl for ION_IOC_FREE currently passes allocation data
instead of the free data. Correct this.

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: Laura Abbott &lt;lauraa@codeaurora.org&gt;
[jstultz: Folded in a small build fix]
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>staging: ion: Fix overflow and list bugs in system heap</title>
<updated>2014-02-07T17:03:16+00:00</updated>
<author>
<name>Colin Cross</name>
<email>ccross@android.com</email>
</author>
<published>2014-02-05T00:08:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c9e8440eca61298ecccbb27f53036124a7a3c6c8'/>
<id>c9e8440eca61298ecccbb27f53036124a7a3c6c8</id>
<content type='text'>
Fix a few bugs in ion_system_heap:

Initialize the list node in the info block.

Don't store size_remaining in a signed long, allocating &gt;2GB
could overflow, resulting in a call to sg_alloc_table with
nents=0 which panics.  alloc_largest_available will never
return a block larger than size_remanining, so it can never
go negative.

Limit a single allocation to half of all memory.  Prevents a
large allocation from taking down the whole system.

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: Colin Cross &lt;ccross@android.com&gt;
[jstultz: Minor commit subject tweak]
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix a few bugs in ion_system_heap:

Initialize the list node in the info block.

Don't store size_remaining in a signed long, allocating &gt;2GB
could overflow, resulting in a call to sg_alloc_table with
nents=0 which panics.  alloc_largest_available will never
return a block larger than size_remanining, so it can never
go negative.

Limit a single allocation to half of all memory.  Prevents a
large allocation from taking down the whole system.

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: Colin Cross &lt;ccross@android.com&gt;
[jstultz: Minor commit subject tweak]
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>staging: ashmem: Avoid deadlock between read and mmap calls</title>
<updated>2014-02-07T17:03:16+00:00</updated>
<author>
<name>Todd Poynor</name>
<email>toddpoynor@google.com</email>
</author>
<published>2014-02-05T00:08:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=077f6db9731673753ca41a5c3acbb5ead142658a'/>
<id>077f6db9731673753ca41a5c3acbb5ead142658a</id>
<content type='text'>
Avoid holding ashmem_mutex across code that can page fault.  Page faults
grab the mmap_sem for the process, which are also held by mmap calls
prior to calling ashmem_mmap, which locks ashmem_mutex.  The reversed
order of locking between the two can deadlock.

The calls that can page fault are read() and the ASHMEM_SET_NAME and
ASHMEM_GET_NAME ioctls.  Move the code that accesses userspace pages
outside the ashmem_mutex.

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: Todd Poynor &lt;toddpoynor@google.com&gt;
[jstultz: minor commit message tweaks]
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Avoid holding ashmem_mutex across code that can page fault.  Page faults
grab the mmap_sem for the process, which are also held by mmap calls
prior to calling ashmem_mmap, which locks ashmem_mutex.  The reversed
order of locking between the two can deadlock.

The calls that can page fault are read() and the ASHMEM_SET_NAME and
ASHMEM_GET_NAME ioctls.  Move the code that accesses userspace pages
outside the ashmem_mutex.

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: Todd Poynor &lt;toddpoynor@google.com&gt;
[jstultz: minor commit message tweaks]
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>staging: sync: Fix a race condition between release_obj and print_obj</title>
<updated>2014-02-07T17:03:16+00:00</updated>
<author>
<name>Alistair Strachan</name>
<email>alistair.strachan@imgtec.com</email>
</author>
<published>2014-02-05T00:08:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=5cf045f54d31894ec59ee741e01fa258be2ba0fb'/>
<id>5cf045f54d31894ec59ee741e01fa258be2ba0fb</id>
<content type='text'>
Before this change, a timeline would only be removed from the timeline
list *after* the sync driver had its release_obj() called. However, the
driver's release_obj() may free resources needed by print_obj().

Although the timeline list is locked when print_obj() is called, it is
not locked when release_obj() is called. If one CPU was in print_obj()
when another was in release_obj(), the print_obj() may make unsafe
accesses.

It is not actually necessary to hold the timeline list lock when calling
release_obj() if the call is made after the timeline is unlinked from
the list, since there is no possibility another thread could be in --
or enter -- print_obj() for that timeline.

This change moves the release_obj() call to after the timeline is
unlinked, preventing the above race from occurring.

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: Alistair Strachan &lt;alistair.strachan@imgtec.com&gt;
[jstultz: minor commit subject tweak]
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this change, a timeline would only be removed from the timeline
list *after* the sync driver had its release_obj() called. However, the
driver's release_obj() may free resources needed by print_obj().

Although the timeline list is locked when print_obj() is called, it is
not locked when release_obj() is called. If one CPU was in print_obj()
when another was in release_obj(), the print_obj() may make unsafe
accesses.

It is not actually necessary to hold the timeline list lock when calling
release_obj() if the call is made after the timeline is unlinked from
the list, since there is no possibility another thread could be in --
or enter -- print_obj() for that timeline.

This change moves the release_obj() call to after the timeline is
unlinked, preventing the above race from occurring.

Cc: Colin Cross &lt;ccross@android.com&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: Alistair Strachan &lt;alistair.strachan@imgtec.com&gt;
[jstultz: minor commit subject tweak]
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
