staging: ion: always initialize the free list parameters
authorMitchel Humpherys <mitchelh@codeaurora.org>
Fri, 9 Jan 2015 01:24:27 +0000 (17:24 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 Jan 2015 00:16:00 +0000 (16:16 -0800)
commit95e53ddd8240bad37df985a9ae2d2a07f49e6bf1
tree5e928f89e3c8cdbad12c6ccfa8594c6c14e9b46e
parent38c977230c4947d1e99c558a603eb49666a42568
staging: ion: always initialize the free list parameters

Currently we initialize the heap free_lock and free list size in
ion_heap_init_deferred_free, which is only called when the
ION_HEAP_FLAG_DEFER_FREE heap flag is given.  However, the lock and size
are used in the shrinker path as well as the deferred free path, and we
can register a shrinker *without* enabling deferred freeing.  So, if a
heap provides a shrinker but *doesn't* set the DEFER_FREE flag we will
use these parameters uninitialized (resulting in a spinlock bug and
broken shrinker accounting).

Fix these problems by initializing the free list parameters directly in
ion_device_add_heap, which is always called no matter which heap
features are being used.

Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion.c
drivers/staging/android/ion/ion_heap.c