diff options
Diffstat (limited to 'block/blk-flush.c')
-rw-r--r-- | block/blk-flush.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c index 53abb5c73d99..fd5cee9f1a3b 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -231,6 +231,12 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error) return; } + /* + * Flush request has to be marked as IDLE when it is really ended + * because its .end_io() is called from timeout code path too for + * avoiding use-after-free. + */ + WRITE_ONCE(flush_rq->state, MQ_RQ_IDLE); if (fq->rq_status != BLK_STS_OK) error = fq->rq_status; |