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]
Date:	Fri, 27 Mar 2015 09:46:30 +0100
From:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:	Sudip Mukherjee <sudipm.mukherjee@...il.com>
Cc:	Benjamin Romer <benjamin.romer@...sys.com>,
	David Kershner <david.kershner@...sys.com>,
	sparmaintainer@...sys.com, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] staging: unisys: unregister chardev on error

On Fri, Mar 27, 2015 at 02:00:57PM +0530, Sudip Mukherjee wrote:
> after registering the major numbers if the cdev_add fails then we were
> not releasing the major numbers. now we are doing that.
> 
> Signed-off-by: Sudip Mukherjee <sudip@...torindia.org>
> ---
>  drivers/staging/unisys/visorchipset/file.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c
> index 39b19af..074c285 100644
> --- a/drivers/staging/unisys/visorchipset/file.c
> +++ b/drivers/staging/unisys/visorchipset/file.c
> @@ -65,8 +65,10 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel)
>  			return -1;
>  	}
>  	rc = cdev_add(&file_cdev, MKDEV(MAJOR(major_dev), 0), 1);
> -	if (rc  < 0)
> +	if (rc  < 0) {

Care to delete the extra space while you are modifying this line?

> +		unregister_chrdev_region(major_dev, 1);
>  		return -1;

It's not your fault, and don't change this, but something that needs to
be fixed up in the future are these "random" negative numbers being
returned.  Use proper -ERROR #defines instead.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ