]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
staging: android: sync: Fix memory corruption in sync_timeline_signal().
authorAlistair Strachan <alistair.strachan@imgtec.com>
Tue, 24 Mar 2015 21:51:31 +0000 (14:51 -0700)
committerSasha Levin <sasha.levin@oracle.com>
Sun, 17 May 2015 23:11:52 +0000 (19:11 -0400)
commitf364a04fb44955c96c08f99171ba1cf822dcdea1
treee6005829576eb153f6234a347821f8d630db4a92
parentfd431a7ce42c056a0e1783074cfece4058cbbd3b
staging: android: sync: Fix memory corruption in sync_timeline_signal().

[ Upstream commit 8e43c9c75faf2902955bd2ecd7a50a8cc41cb00a ]

The android_fence_release() function checks for active sync points
by calling list_empty() on the list head embedded on the sync
point. However, it is only valid to use list_empty() on nodes that
have been initialized with INIT_LIST_HEAD() or list_del_init().

Because the list entry has likely been removed from the active list
by sync_timeline_signal(), there is a good chance that this
WARN_ON_ONCE() will be hit due to dangling pointers pointing at
freed memory (even though the sync drivers did nothing wrong)
and memory corruption will ensue as the list entry is removed for
a second time, corrupting the active list.

This problem can be reproduced quite easily with CONFIG_DEBUG_LIST=y
and fences with more than one sync point.

Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Colin Cross <ccross@google.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/staging/android/sync.c