Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] cfq-iosched: fix crash in do_div()

We don't clear the seek stat values in cfq_alloc_io_context(), and if
->seek_mean is unlucky enough to be set to -36 by chance, the first
invocation of cfq_update_io_seektime() will oops with a divide by zero
in do_div().

Just memset the entire cic instead of filling invididual values
independently.

Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Jens Axboe and committed by
Linus Torvalds
553698f9 9cedc194

+3 -8
+3 -8
block/cfq-iosched.c
··· 1323 1323 struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask); 1324 1324 1325 1325 if (cic) { 1326 - RB_CLEAR(&cic->rb_node); 1327 - cic->key = NULL; 1328 - cic->cfqq[ASYNC] = NULL; 1329 - cic->cfqq[SYNC] = NULL; 1326 + memset(cic, 0, sizeof(*cic)); 1327 + RB_CLEAR_COLOR(&cic->rb_node); 1330 1328 cic->last_end_request = jiffies; 1331 - cic->ttime_total = 0; 1332 - cic->ttime_samples = 0; 1333 - cic->ttime_mean = 0; 1329 + INIT_LIST_HEAD(&cic->queue_list); 1334 1330 cic->dtor = cfq_free_io_context; 1335 1331 cic->exit = cfq_exit_io_context; 1336 - INIT_LIST_HEAD(&cic->queue_list); 1337 1332 atomic_inc(&ioc_count); 1338 1333 } 1339 1334