Skip to content

Commit

Permalink
block: enforce constraints on block size properties
Browse files Browse the repository at this point in the history
Nicolae Mogoreanu <[email protected]> noticed that I/O requests can lead
to QEMU crashes when the logical_block_size property is smaller than 512
bytes.

Using the new "blocksize" property we can properly enforce constraints
on the block size such that QEMU's block layer is able to operate
correctly.

Reported-by: Nicolae Mogoreanu <[email protected]>
Reported-by: Michael Halcrow <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
  • Loading branch information
Stefan Hajnoczi authored and kevmw committed Apr 5, 2012
1 parent 02fda01 commit 1fc86bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions block.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)

#define DEFINE_BLOCK_PROPERTIES(_state, _conf) \
DEFINE_PROP_DRIVE("drive", _state, _conf.bs), \
DEFINE_PROP_UINT16("logical_block_size", _state, \
_conf.logical_block_size, 512), \
DEFINE_PROP_UINT16("physical_block_size", _state, \
_conf.physical_block_size, 512), \
DEFINE_PROP_BLOCKSIZE("logical_block_size", _state, \
_conf.logical_block_size, 512), \
DEFINE_PROP_BLOCKSIZE("physical_block_size", _state, \
_conf.physical_block_size, 512), \
DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \
DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \
DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1), \
Expand Down

0 comments on commit 1fc86bf

Please sign in to comment.