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  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:   Wed, 29 Nov 2017 08:06:01 +0000
From:   "Wang, Alan 1. (NSB - CN/Hangzhou)" <>
To:     Wolfram Sang <>
CC:     "" <>,
        "" <>
Subject: RE: [PATCH] i2c: core: decrease reference count of device node in

Hi Wolfram,

In my understand, the of_node_put(bus) is to of_get_child_by_name((adap->dev.of_node, "i2c-bus") or of_node_get(adap->dev.of_node).

What I said is the children of "bus" increased by "info.of_node = of_node_get(node)" in function of_i2c_register_device.

My description in last mail maybe not properly, I think all the nodes accessed by of_i2c_register_device shall not be decreased, not only the dynamically added ones. 

In my case, the SFP devices as i2c clients on one board are connected to the bus through i2c mux.
When plugin the board, all the related nodes are dynamically allocated and added into the device tree.
Then the probe function calls of_i2c_register_devices, in which the reference count increased by " info.of_node = of_node_get(node)".
When plug out the board, because the reference count of those nodes are not decreased down to 0, the memory of the nodes and their properties are not released.
New memory will be allocated but not released in the next plugin and plug out looping test. 

Best Regards,
Lixin Wang

> -----Original Message-----
> From: Wolfram Sang []
> Sent: Tuesday, November 28, 2017 2:22 AM
> To: Wang, Alan 1. (NSB - CN/Hangzhou) <>
> Cc:;
> Subject: Re: [PATCH] i2c: core: decrease reference count of device node in
> i2c_unregister_device
> On Mon, Nov 27, 2017 at 03:06:55PM +0800, Lixin Wang wrote:
> > Reference count of device node was increased in
> > of_i2c_register_device, but without decreasing it in i2c_unregister_device.
> Huh, there is an of_node_put(bus) in of_i2c_register_device?
> > Then the dynamically
> > added device node will never be released.
> Strange. Can you provide your test case, please?

Powered by blists - more mailing lists