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] [day] [month] [year] [list]
Message-ID: <143998a3-6c53-77f0-ef8c-af428ac64001@huawei.com>
Date:   Thu, 4 Nov 2021 18:57:10 +0800
From:   Wu Bo <wubo40@...wei.com>
To:     Luis Chamberlain <mcgrof@...nel.org>, <axboe@...nel.dk>,
        <hare@...e.de>, <hch@...radead.org>
CC:     <linux-block@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        "kernel test robot" <lkp@...el.com>,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH] block: fix device_add_disk() kobject_create_and_add()
 error handling

On 2021/11/4 0:40, Luis Chamberlain wrote:
> Commit 83cbce957446 ("block: add error handling for device_add_disk /
> add_disk") added error handling to device_add_disk(), however the goto
> label for the kobject_create_and_add() failure did not set the return
> value correctly, and so we can end up in a situation where
> kobject_create_and_add() fails but we report success.
> 
> Fixes: 83cbce957446 ("block: add error handling for device_add_disk / add_disk")
> Reported-by: kernel test robot <lkp@...el.com>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
> ---
>   block/genhd.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index be4775c13760..b0b484116c3a 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -478,8 +478,10 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
>   	if (!disk->part0->bd_holder_dir)

in here also should be add ret = -ENOMEM;

>   		goto out_del_integrity;
>   	disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj);
> -	if (!disk->slave_dir)
> +	if (!disk->slave_dir) {
> +		ret = -ENOMEM;
>   		goto out_put_holder_dir;
> +	}
>   
>   	ret = bd_register_pending_holders(disk);
>   	if (ret < 0)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ