• Mitchel Humpherys's avatar
    staging: ion: always initialize the free list parameters · 95e53ddd
    Mitchel Humpherys authored
    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: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    95e53ddd
ion_heap.c 8.91 KB