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: <5711019E.9020304@mentor.com>
Date:	Fri, 15 Apr 2016 17:58:38 +0300
From:	Vladimir Zapolskiy <vladimir_zapolskiy@...tor.com>
To:	Jon Hunter <jonathanh@...dia.com>, Wolfram Sang <wsa@...-dreams.de>
CC:	<linux-i2c@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] i2c: core: Add missing of_node_put()

On 15.04.2016 15:43, Jon Hunter wrote:
> for_each_available_child_of_node performs an of_node_get on each
> iteration, so of_node_put() must be called on each iteration once
> we are finished with the node pointer.

This is wrong, embedded of_get_next_available_child() correctly decrements
ref counter of an examined node.

> Signed-off-by: Jon Hunter <jonathanh@...dia.com>
> ---
>  drivers/i2c/i2c-core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 4979728f7fb2..38f4dae681a9 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -1428,9 +1428,9 @@ static void of_i2c_register_devices(struct i2c_adapter *adap)
>  	dev_dbg(&adap->dev, "of_i2c: walking child nodes\n");
>  
>  	for_each_available_child_of_node(adap->dev.of_node, node) {
> -		if (of_node_test_and_set_flag(node, OF_POPULATED))
> -			continue;
> -		of_i2c_register_device(adap, node);
> +		if (!of_node_test_and_set_flag(node, OF_POPULATED))
> +			of_i2c_register_device(adap, node);
> +		of_node_put(node);
>  	}
>  }
>  
> 

--
With best wishes,
Vladimir

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ