]> git.baikalelectronics.ru Git - kernel.git/commit
block: null_blk: Fix null_zone_write()
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Thu, 2 Jun 2022 12:03:44 +0000 (21:03 +0900)
committerJens Axboe <axboe@kernel.dk>
Thu, 2 Jun 2022 13:11:28 +0000 (07:11 -0600)
commit9c81d6bbacb41ae6da17578f6779dd8ae9930be0
tree6493baa81013cfe7bf690157723e390eec42dcf6
parente8ecd6f1271821d661cebc3947947744155a9a3e
block: null_blk: Fix null_zone_write()

The bio and rq fields of struct nullb_cmd are now overlapping in a
union. So we cannot use a test on ->bio being non-NULL to detect the
NULL_Q_BIO queue mode. null_zone_write() use such broken test to set the
sector position of a zone append write in the command bio or request.
When the null_blk device uses the NULL_Q_MQ queue mode,
null_zone_write() wrongly end up setting the bio sector position,
resulting in the command request to be broken and random crashes
following.

Fix this by testing the device queue mode directly.

Fixes: 31d8a3215da3 ("null-blk: save memory footprint for struct nullb_cmd")
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20220602120344.1365329-1-damien.lemoal@opensource.wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/null_blk/main.c
drivers/block/null_blk/null_blk.h
drivers/block/null_blk/zoned.c