[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180801165011.823252277@linuxfoundation.org>
Date: Wed, 1 Aug 2018 18:48:32 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Lixin Wang <alan.1.wang@...ia-sbell.com>,
Wolfram Sang <wsa@...-dreams.de>, stable@...nel.org,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: [PATCH 4.14 002/246] i2c: core: decrease reference count of device node in i2c_unregister_device
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lixin Wang <alan.1.wang@...ia-sbell.com>
commit e0638fa400eaccf9fa8060f67140264c4e276552 upstream.
Reference count of device node was increased in of_i2c_register_device,
but without decreasing it in i2c_unregister_device. Then the added
device node will never be released. Fix this by adding the of_node_put.
Signed-off-by: Lixin Wang <alan.1.wang@...ia-sbell.com>
Tested-by: Wolfram Sang <wsa@...-dreams.de>
Signed-off-by: Wolfram Sang <wsa@...-dreams.de>
Cc: stable@...nel.org
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@...il.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/i2c/i2c-core-base.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -808,8 +808,11 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
*/
void i2c_unregister_device(struct i2c_client *client)
{
- if (client->dev.of_node)
+ if (client->dev.of_node) {
of_node_clear_flag(client->dev.of_node, OF_POPULATED);
+ of_node_put(client->dev.of_node);
+ }
+
if (ACPI_COMPANION(&client->dev))
acpi_device_clear_enumerated(ACPI_COMPANION(&client->dev));
device_unregister(&client->dev);
Powered by blists - more mailing lists