Skip to content

Commit

Permalink
block: pass no-op callback to INIT_WORK().
Browse files Browse the repository at this point in the history
syzbot is hitting flush_work() warning caused by commit 4d43d39
("workqueue: Try to catch flush_work() without INIT_WORK().") [1].
Although that commit did not expect INIT_WORK(NULL) case, calling
flush_work() without setting a valid callback should be avoided anyway.
Fix this problem by setting a no-op callback instead of NULL.

[1] https://syzkaller.appspot.com/bug?id=e390366bc48bc82a7c668326e0663be3b91cbd29

Signed-off-by: Tetsuo Handa <[email protected]>
Reported-and-tested-by: syzbot <[email protected]>
Cc: Tejun Heo <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Tetsuo Handa authored and axboe committed Jan 30, 2019
1 parent 3ca17a2 commit 2e3c18d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ static void blk_rq_timed_out_timer(struct timer_list *t)
kblockd_schedule_work(&q->timeout_work);
}

static void blk_timeout_work(struct work_struct *work)
{
}

/**
* blk_alloc_queue_node - allocate a request queue
* @gfp_mask: memory allocation flags
Expand Down Expand Up @@ -505,7 +509,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
timer_setup(&q->backing_dev_info->laptop_mode_wb_timer,
laptop_mode_timer_fn, 0);
timer_setup(&q->timeout, blk_rq_timed_out_timer, 0);
INIT_WORK(&q->timeout_work, NULL);
INIT_WORK(&q->timeout_work, blk_timeout_work);
INIT_LIST_HEAD(&q->icq_list);
#ifdef CONFIG_BLK_CGROUP
INIT_LIST_HEAD(&q->blkg_list);
Expand Down

0 comments on commit 2e3c18d

Please sign in to comment.