Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1157654imm; Wed, 1 Aug 2018 11:08:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe/TH7USS5+XUkDTANAJOocoojRNy4jex/3eeUNpNWo2L8Jo7V6BXW6VNzMZW0J9lNPh5jZ X-Received: by 2002:a65:520d:: with SMTP id o13-v6mr25296059pgp.282.1533146885138; Wed, 01 Aug 2018 11:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533146885; cv=none; d=google.com; s=arc-20160816; b=VAoXpE6v7lC5FO7TJACq1RZxvKlTWvOzAHJllzhxkqqllERVu8tmBB1JjkipMjzcHJ MAgUpWUc7imUfeB4CkFbR6XDSc/D/IlIf9jxiAuisDTdCZ8LvL/Urm439idVbdiUG7HR hl/bYLC+YJ3rQ/wSy8q3givKagXA+yBcmqS6a1OZipUszVwzqBXWfPFltzDhfF47WwuE 6xEmMoP6S7OTSVyc38fJESR/bNDNy/mkeByTwAsuSx5QemhCyWGLZkAJKo4adLZLjLeo im3lyUuvzsjOKM1dDkDPsNcXsREIUk8gkN+ATuHj+sZ4xs0K6iLmVgmbi+Zr86ZA0bu4 mqcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=15/DMNc5iBrAOyQnI/wx8vj8CCf0GpAzkeazux1zDH4=; b=MaM0UOocKYMBzzbmgNAaiNHKczsBWGBN3UcgNa+VhuJQi3phzVK9qQ6qDGYnzNdU6s +vO8A8fsufJmyq7h985/bUh5BvRiTMbf4pMEUnIZCoVT3M17dGyaRs5Z+In5hJbRlA+0 73/WrBqaXsHqpD6ZQCvIhQL+3xEDYZsmeKCDwv5nV4fk76Dnfrb+/3i2P0YmjPGCfHwR Sbmzcgq1bWroJkhKSnJuIQC5ygasuHJkkS+dW0ORP/5h3lZURdUZHSqhVdwPNXLeilm3 QpBezRNdVdSE6op3OmW0f18dP4rciFmyYZPW0T9OH5J6fwxoX5Alk6lCBe8DyfJtiVc9 hqVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 144-v6si14436583pfw.95.2018.08.01.11.07.50; Wed, 01 Aug 2018 11:08:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732556AbeHATxv (ORCPT + 99 others); Wed, 1 Aug 2018 15:53:51 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50242 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405285AbeHATIh (ORCPT ); Wed, 1 Aug 2018 15:08:37 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5E607133A; Wed, 1 Aug 2018 17:12:20 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lixin Wang , Wolfram Sang , stable@kernel.org, Sudip Mukherjee Subject: [PATCH 4.14 002/246] i2c: core: decrease reference count of device node in i2c_unregister_device Date: Wed, 1 Aug 2018 18:48:32 +0200 Message-Id: <20180801165011.823252277@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lixin Wang 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 Tested-by: Wolfram Sang Signed-off-by: Wolfram Sang Cc: stable@kernel.org Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- 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);