mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-06 17:35:20 +02:00
null_blk: Fix return value of nullb_device_power_store()
commitd9ff882b54
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e0b065ec63
commit
e0aba0c6d5
|
@ -470,6 +470,7 @@ static ssize_t nullb_device_power_store(struct config_item *item,
|
||||||
|
|
||||||
set_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags);
|
set_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags);
|
||||||
dev->power = newp;
|
dev->power = newp;
|
||||||
|
ret = count;
|
||||||
} else if (dev->power && !newp) {
|
} else if (dev->power && !newp) {
|
||||||
if (test_and_clear_bit(NULLB_DEV_FL_UP, &dev->flags)) {
|
if (test_and_clear_bit(NULLB_DEV_FL_UP, &dev->flags)) {
|
||||||
dev->power = newp;
|
dev->power = newp;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user