linux/drivers/block/null_blk
Damien Le Moal 777595da53 null_blk: Fix return value of nullb_device_power_store()
commit d9ff882b54 upstream.

When powering on a null_blk device that is not already on, the return
value ret that is initialized to be count is reused to check the return
value of null_add_dev(), leading to nullb_device_power_store() to return
null_add_dev() return value (0 on success) instead of "count".
So make sure to set ret to be equal to count when there are no errors.

Fixes: a2db328b08 ("null_blk: fix null-ptr-dereference while configuring 'power' and 'submit_queues'")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Link: https://lore.kernel.org/r/20240527043445.235267-1-dlemoal@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2024-11-22 15:37:35 +01:00
..
Kconfig null_blk: Move driver into its own directory 2020-12-07 17:36:04 -07:00
main.c null_blk: Fix return value of nullb_device_power_store() 2024-11-22 15:37:35 +01:00
Makefile null_blk: Move driver into its own directory 2020-12-07 17:36:04 -07:00
null_blk.h null_blk: add configfs variables for 2 options 2022-08-02 17:15:02 -06:00
trace.c null_blk: Move driver into its own directory 2020-12-07 17:36:04 -07:00
trace.h treewide: Rename enum req_opf into enum req_op 2022-07-14 12:14:30 -06:00
zoned.c null_blk: Do not allow runt zone with zone capacity smaller then zone size 2024-07-11 12:47:18 +02:00