• Alexey Gladkov's avatar
    ucounts: Increase ucounts reference counter before the security hook · bbb6d0f3
    Alexey Gladkov authored
    We need to increment the ucounts reference counter befor security_prepare_creds()
    because this function may fail and abort_creds() will try to decrement
    this reference.
    
    [   96.465056][ T8641] FAULT_INJECTION: forcing a failure.
    [   96.465056][ T8641] name fail_page_alloc, interval 1, probability 0, space 0, times 0
    [   96.478453][ T8641] CPU: 1 PID: 8641 Comm: syz-executor668 Not tainted 5.14.0-rc6-syzkaller #0
    [   96.487215][ T8641] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    [   96.497254][ T8641] Call Trace:
    [   96.500517][ T8641]  dump_stack_lvl+0x1d3/0x29f
    [   96.505758][ T8641]  ? show_regs_print_info+0x12/0x12
    [   96.510944][ T8641]  ? log_buf_vmcoreinfo_setup+0x498/0x498
    [   96.516652][ T8641]  should_fail+0x384/0x4b0
    [   96.521141][ T8641]  prepare_alloc_pages+0x1d1/0x5a0
    [   96.526236][ T8641]  __alloc_pages+0x14d/0x5f0
    [   96.530808][ T8641]  ? __rmqueue_pcplist+0x2030/0x2030
    [   ...
    bbb6d0f3
cred.c 24.4 KB