In the Linux kernel, the following vulnerability has been resolved:
md/raid5-cache: fix null-ptr-deref for r5lflushstripetoraid()
r5lflushstripetoraid() will check if the list 'flushingios' is empty, and then submit 'flushbio', however, r5llogflush_endio() is clearing the list first and then clear the bio, which will cause null-ptr-deref:
T1: submit flush io raid5d handleactivestripes r5lflushstripetoraid // list is empty // add 'ioendios' to the list bioinit submitbio // io1
T2: io1 is done r5llogflushendio listsplicetailinit // clear the list T3: submit new flush io ... r5lflushstripetoraid // list is empty // add 'ioendios' to the list bioinit biouninit // clear bio->biblkg submitbio // null-ptr-deref
Fix this problem by clearing bio before clearing the list in r5llogflush_endio().