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: <4FBD02CC.4080600@linux.vnet.ibm.com>
Date:	Wed, 23 May 2012 12:31:24 -0300
From:	Rajiv Andrade <srajiv@...ux.vnet.ibm.com>
To:	Wanlong Gao <gaowanlong@...fujitsu.com>
CC:	debora@...ux.vnet.ibm.com, tpmdd-devel@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tpm: fix memleak when register hardware fails

On 16/05/12 05:24, Wanlong Gao wrote:
> Signed-off-by: Wanlong Gao<gaowanlong@...fujitsu.com>
> ---
>   drivers/char/tpm/tpm.c |    9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
> index ad7c732..c967919 100644
> --- a/drivers/char/tpm/tpm.c
> +++ b/drivers/char/tpm/tpm.c
> @@ -1405,15 +1405,12 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
>   			"unable to misc_register %s, minor %d\n",
>   			chip->vendor.miscdev.name,
>   			chip->vendor.miscdev.minor);
> -		put_device(chip->dev);
> -		return NULL;
> +		goto put_device;
>   	}
>
>   	if (sysfs_create_group(&dev->kobj, chip->vendor.attr_group)) {
>   		misc_deregister(&chip->vendor.miscdev);
> -		put_device(chip->dev);
> -
> -		return NULL;
> +		goto put_device;
>   	}
>
>   	chip->bios_dir = tpm_bios_log_setup(devname);
> @@ -1425,6 +1422,8 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
>
>   	return chip;
>
> +put_device:
> +	put_device(chip->dev);
>   out_free:
>   	kfree(chip);
>   	kfree(devname);
Thanks Wanlong, will merge and send James through a git-pull today.

--
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