Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
blk-mq: fix undefined behaviour in order_to_size()
commit b3a834b upstream. When this_order variable in blk_mq_init_rq_map() becomes zero the code incorrectly decrements the variable and passes the result to order_to_size() helper causing undefined behaviour: UBSAN: Undefined behaviour in block/blk-mq.c:1459:27 shift exponent 4294967295 is too large for 32-bit type 'unsigned int' CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc6-00072-g33656a1 TheScarastic#22 Fix the code by checking this_order variable for not having the zero value first. Reported-by: Meelis Roos <[email protected]> Fixes: 320ae51 ("blk-mq: new multi-queue block IO queueing mechanism") Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]> Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Lee Jones <[email protected]> Change-Id: Ibf5ca9d79fe3580fe057d27da05cb29348b53781
- Loading branch information