lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b34d9107-bf6b-163e-9e8c-9e903565bb26@huaweicloud.com>
Date: Mon, 14 Apr 2025 10:58:50 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: Zheng Qixing <zhengqixing@...weicloud.com>, axboe@...nel.dk
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
 yi.zhang@...wei.com, yangerkun@...wei.com, zhengqixing@...wei.com,
 "yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH] block: fix resource leak in blk_register_queue() error
 path

在 2025/04/12 17:25, Zheng Qixing 写道:
> From: Zheng Qixing <zhengqixing@...wei.com>
> 
> When registering a queue fails after blk_mq_sysfs_register() is
> successful but the function later encounters an error, we need
> to clean up the blk_mq_sysfs resources.
> 
> Add the missing blk_mq_sysfs_unregister() call in the error path
> to properly clean up these resources and prevent a memory leak.
> 
> Fixes: 320ae51feed5 ("blk-mq: new multi-queue block IO queueing mechanism")
> Signed-off-by: Zheng Qixing <zhengqixing@...wei.com>
> ---
>   block/blk-sysfs.c | 2 ++
>   1 file changed, 2 insertions(+)
> 

LGTM
Reviewed-by: Yu Kuai <yukuai3@...wei.com>
> diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
> index a2882751f0d2..1f9b45b0b9ee 100644
> --- a/block/blk-sysfs.c
> +++ b/block/blk-sysfs.c
> @@ -909,6 +909,8 @@ int blk_register_queue(struct gendisk *disk)
>   out_debugfs_remove:
>   	blk_debugfs_remove(disk);
>   	mutex_unlock(&q->sysfs_lock);
> +	if (queue_is_mq(q))
> +		blk_mq_sysfs_unregister(disk);
>   out_put_queue_kobj:
>   	kobject_put(&disk->queue_kobj);
>   	return ret;
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ