• Johannes Weiner's avatar
    mm: memcontrol: fix NULL pointer crash in test_clear_page_writeback() · dee92931
    Johannes Weiner authored
    commit 739f79fc upstream.
    
    Jaegeuk and Brad report a NULL pointer crash when writeback ending tries
    to update the memcg stats:
    
        BUG: unable to handle kernel NULL pointer dereference at 00000000000003b0
        IP: test_clear_page_writeback+0x12e/0x2c0
        [...]
        RIP: 0010:test_clear_page_writeback+0x12e/0x2c0
        Call Trace:
         <IRQ>
         end_page_writeback+0x47/0x70
         f2fs_write_end_io+0x76/0x180 [f2fs]
         bio_endio+0x9f/0x120
         blk_update_request+0xa8/0x2f0
         scsi_end_request+0x39/0x1d0
         scsi_io_completion+0x211/0x690
         scsi_finish_command+0xd9/0x120
         scsi_softirq_done+0x127/0x150
         __blk_mq_complete_request_remote+0x13/0x20
         flush_smp_call_function_queue+0x56/0x110
         generic_smp_call_function_single_interrupt+0x13/0x30
         smp_call_function_single_interrupt+0x27/0x40
         call_function_single_interrupt+0x89/0x90
        RIP: 0010:native_safe_halt+0x6/0x10
    
        (gdb) l ...
    dee92931
memcontrol.c 157 KB