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: <Ys/i3EBk2nZea8Hy@kroah.com>
Date:   Thu, 14 Jul 2022 11:33:16 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        logang@...tatee.com, dan.j.williams@...el.com,
        hans.verkuil@...co.com, alexandre.belloni@...e-electrons.com,
        viro@...iv.linux.org.uk
Subject: Re: [PATCH RESEND] chardev: fix error handling in cdev_device_add()

On Thu, Jul 14, 2022 at 05:23:55PM +0800, Yang Yingliang wrote:
> If dev->devt is not set, cdev_add() will not be called, so if device_add()
> fails, cdev_del() is not needed. Fix this by checking dev->devt in error
> case.
> 
> Fixes: 233ed09d7fda ("chardev: add helper function to register char devs with a struct device")
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
>  fs/char_dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/char_dev.c b/fs/char_dev.c
> index ba0ded7842a7..3f667292608c 100644
> --- a/fs/char_dev.c
> +++ b/fs/char_dev.c
> @@ -547,7 +547,7 @@ int cdev_device_add(struct cdev *cdev, struct device *dev)
>  	}
>  
>  	rc = device_add(dev);
> -	if (rc)
> +	if (rc && dev->devt)
>  		cdev_del(cdev);
>  
>  	return rc;
> -- 
> 2.25.1
> 

Please see https://lore.kernel.org/r/YsLtXYa4kRYEEaX/@kroah.com for why
I will no longer accept patches from Huawei with the "hulk robot" claim
without the required information.

Also, you did not state why this was a RESEND.

Now dropped from my review queue,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ