"lib/iov_iter.c" did not exist on "d271524a3a1da99e3809afaa10903cc2905bc9a7"
  • Jerome Marchand's avatar
    assoc_array: don't call compare_object() on a node · 32d1b672
    Jerome Marchand authored
    [ Upstream commit 8d4a2ec1 ]
    
    Changes since V1: fixed the description and added KASan warning.
    
    In assoc_array_insert_into_terminal_node(), we call the
    compare_object() method on all non-empty slots, even when they're
    not leaves, passing a pointer to an unexpected structure to
    compare_object(). Currently it causes an out-of-bound read access
    in keyring_compare_object detected by KASan (see below). The issue
    is easily reproduced with keyutils testsuite.
    Only call compare_object() when the slot is a leave.
    
    KASan warning:
    ==================================================================
    BUG: KASAN: slab-out-of-bounds in keyring_compare_object+0x213/0x240 at addr ffff880060a6f838
    Read of size 8 by task keyctl/1655
    =============================================================================
    BUG kmalloc-192 (Not tainted): kasan: bad access detected
    -----------------------------------------------------------------------------
    
    ...
    32d1b672
assoc_array.c 52.6 KB