Skip to content

Commit 2326a84

Browse files
committed
null_blk: Fix return value of nullb_device_power_store()
jira LE-1907 Rebuild_History Non-Buildable kernel-5.14.0-427.40.1.el9_4 commit-author Damien Le Moal <dlemoal@kernel.org> commit d9ff882 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: a2db328 ("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> (cherry picked from commit d9ff882) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 7a37f44 commit 2326a84

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/block/null_blk/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ static ssize_t nullb_device_power_store(struct config_item *item,
455455

456456
set_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags);
457457
dev->power = newp;
458+
ret = count;
458459
} else if (dev->power && !newp) {
459460
if (test_and_clear_bit(NULLB_DEV_FL_UP, &dev->flags)) {
460461
mutex_lock(&lock);

0 commit comments

Comments
 (0)