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: <4FACAE84.6080501@hrz.tu-chemnitz.de>
Date:	Fri, 11 May 2012 08:15:32 +0200
From:	Markus Franke <markus.franke@...02.tu-chemnitz.de>
To:	Andrew Morton <akpm@...ux-foundation.org>
CC:	Markus Franke <markus.franke@...02.tu-chemnitz.de>,
	Greg KH <greg@...ah.com>, Evgeniy Polyakov <zbr@...emap.net>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] w1: Add 1-wire slave device driver for DS28E04-100

Dear Andrew,

thanks for the feedback.

Am 11.05.2012 01:22, schrieb Andrew Morton:

> On Fri, 11 May 2012 00:57:58 +0200
> Markus Franke <markus.franke@...02.tu-chemnitz.de> wrote:
> 
>> +static int w1_f1C_add_slave(struct w1_slave *sl)
>> +{
>> +	int err = 0;
>> +	int i;
>> +	struct w1_f1C_data *data = NULL;
>> +
>> +	if (w1_enable_crccheck) {
>> +		data = kzalloc(sizeof(struct w1_f1C_data), GFP_KERNEL);
>> +		if (!data)
>> +			return -ENOMEM;
>> +		sl->family_data = data;
>> +	}
>> +
>> +	/* create binary sysfs attributes */
>> +	for (i = 0; i < NB_SYSFS_BIN_FILES && !err; ++i)
>> +		err = sysfs_create_bin_file(
>> +			&sl->dev.kobj, &(w1_f1C_bin_attr[i]));
>> +
>> +	if (err)
>> +		goto out;
> 
> If this goto is taken, we will leak 0..i sysfs files.


That's indeed the case. :-(

>> +	/* create device attributes */
>> +	err = device_create_file(&sl->dev, &dev_attr_crccheck);
>> +
>> +	if (err) {
>> +		/* remove binary sysfs attributes */
>> +		for (i = 0; i < NB_SYSFS_BIN_FILES; ++i)
>> +			sysfs_remove_bin_file(
>> +				&sl->dev.kobj, &(w1_f1C_bin_attr[i]));
>> +	}
>> +
>> +out:
>> +	if (err) {
>> +		if (w1_enable_crccheck)
>> +			kfree(data);
> 
> kfree(NULL) is legal - the w1_enable_crccheck test can be removed.


Ok, I'll fix this for the next (hopefully final) version of the patch.

Best regards,
Markus Franke
--
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