Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Browse files Browse the repository at this point in the history
* 'for-linus' of git://git.kernel.dk/linux-block:
  cfq-iosched: fix use-after-free of cfqq
  • Loading branch information
torvalds committed Jan 17, 2012
2 parents 00b1d44 + 54b466e commit 5e59978
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions block/cfq-iosched.c
Expand Up @@ -3117,18 +3117,17 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
*/
static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq)
{
struct cfq_queue *old_cfqq = cfqd->active_queue;

cfq_log_cfqq(cfqd, cfqq, "preempt");
cfq_slice_expired(cfqd, 1);

/*
* workload type is changed, don't save slice, otherwise preempt
* doesn't happen
*/
if (cfqq_type(old_cfqq) != cfqq_type(cfqq))
if (cfqq_type(cfqd->active_queue) != cfqq_type(cfqq))
cfqq->cfqg->saved_workload_slice = 0;

cfq_slice_expired(cfqd, 1);

/*
* Put the new queue at the front of the of the current list,
* so we know that it will be selected next.
Expand Down

0 comments on commit 5e59978

Please sign in to comment.