diff options
author | Jan Kara <jack@suse.cz> | 2012-10-23 11:05:31 +0200 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-10-23 09:44:20 -0400 |
commit | d8bd7d8c853d6d6470692c22ee767e400a4414f4 (patch) | |
tree | 5cb6532118a0ac6ce7edf7d39041fc6db244b0af | |
parent | fc72001e93d258a0007c2cfc16a6bfc49b791f39 (diff) | |
download | iowatcher-d8bd7d8c853d6d6470692c22ee767e400a4414f4.tar.gz |
Fix crash due to missing queue action
When queue action was missing from a trace, handling of dispatch didn't
quite get things right and crashed due to NULL pointer dereference.
Fix it.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r-- | blkparse.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -246,7 +246,7 @@ static struct pending_io *io_hash_table_search(u64 sector) return NULL; } -static int hash_queued_io(struct blk_io_trace *io) +static struct pending_io *hash_queued_io(struct blk_io_trace *io) { struct pending_io *pio; int ret; @@ -259,9 +259,9 @@ static int hash_queued_io(struct blk_io_trace *io) if (ret < 0) { /* crud, the IO is there already */ free(pio); - return ret; + return NULL; } - return 0; + return pio; } static struct pending_io *hash_dispatched_io(struct blk_io_trace *io) @@ -269,8 +269,11 @@ static struct pending_io *hash_dispatched_io(struct blk_io_trace *io) struct pending_io *pio; pio = io_hash_table_search(io->sector); - if (!pio) - hash_queued_io(io); + if (!pio) { + pio = hash_queued_io(io); + if (!pio) + return NULL; + } pio->dispatch_time = io->time; return pio; } |