Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1617808pxb; Mon, 11 Oct 2021 09:34:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSQ1deKMWyfOzP59X08St8+3QhC9l7cExbbTdZhYt0hJsA+O5JntkwCFgoSM9j+PMmMsCt X-Received: by 2002:a17:906:4e89:: with SMTP id v9mr19759570eju.354.1633970086249; Mon, 11 Oct 2021 09:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633970086; cv=none; d=google.com; s=arc-20160816; b=xdT7h+19FDnshUYeAkilbLHboIxfV+xMSRgfNHyxkTrklXg5In/NYtiAQecwcModk7 NbQhAAUZxkiO0msHignBI5GGcBtHi0SnxpT/1LSugvSCOd9/siaixOh3FhiC8E8OLx7A tRlTnOSWjIHVDEDtYnp4v7fXfTcNSwnpGJ1A5OkYtflZzU+7/Q+3rY3sHArznLpOJRkG noUzu0hFlmXgF+kKTjS4PtZQkvAXu/HhI/y1o/WYU6VqYd5l6sWXf5cTc8ybLglrlKYP hqB2PRfflOYrb62tMwN/hx8UhyIkA2Q6HJZ2sJM6yPgy/534zNcKi4XAWvIKupLF3Omk 9LqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sjILDAh5bUWUQKWV46ZpMKDsi56hGo6Xa+R8LwMgrmQ=; b=MeBXQisO0/7kLSP6y/IT1MBD9PwqZmExvCyE+swx5kn96c52L92vpTJjuyiXBL6I1Q 9j9xBa98wc4/HPoB+2jX1tQHlNc8sRIrVckiGuK2IUIjMWxMqqV7OnD2OO7JOgCsqoFs TMP4Ylqll4wuVttGEh6csBhst3zxcYQkNFiZWHXOHT01lw1axTr5abXZcrszD8NpmeaY Ea6cMyahLGEuZYFAQNl9366EyfLNKEY5c/oTf9eLg0hruWxHpFuuSAWWUCBi5loS8ZDi /ijese7vo7Vff2HMt7OQJQf77+DGmxUjhTmIOwrzkToIsa4Cx2hCfA755Ng6X8xCtS0G 1B7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mwbg+6dW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lx24si12762210ejb.439.2021.10.11.09.34.22; Mon, 11 Oct 2021 09:34:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mwbg+6dW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238549AbhJKOBK (ORCPT + 99 others); Mon, 11 Oct 2021 10:01:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:47528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238513AbhJKN7G (ORCPT ); Mon, 11 Oct 2021 09:59:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 35B8760F21; Mon, 11 Oct 2021 13:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633960550; bh=U3D6DLUaluNReYGyOrXxq1MxzjkBLcc8zxKYHBvuGeI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mwbg+6dWNiZxTb7N/ODRoJE+yANB4QTenO+r9zGtCa3MVdkHstmTzoILM0Pp4XFjp Z5Z5G3aQ+NKfk370SFQnYwWCzlDPewZY2X8OsbJ/EJo++E116ua8Hw4G7H/X4V4rpV gGqVqas2W90CJEDdjmIt9xDUaOhHH6KJAUYXF8rk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jamie Iles , Mika Westerberg , Wolfram Sang , Sasha Levin Subject: [PATCH 5.10 68/83] i2c: acpi: fix resource leak in reconfiguration device addition Date: Mon, 11 Oct 2021 15:46:28 +0200 Message-Id: <20211011134510.737882661@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211011134508.362906295@linuxfoundation.org> References: <20211011134508.362906295@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jamie Iles [ Upstream commit 6558b646ce1c2a872fe1c2c7cb116f05a2c1950f ] acpi_i2c_find_adapter_by_handle() calls bus_find_device() which takes a reference on the adapter which is never released which will result in a reference count leak and render the adapter unremovable. Make sure to put the adapter after creating the client in the same manner that we do for OF. Fixes: 525e6fabeae2 ("i2c / ACPI: add support for ACPI reconfigure notifications") Signed-off-by: Jamie Iles Acked-by: Mika Westerberg [wsa: fixed title] Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/i2c-core-acpi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index 37c510d9347a..4b136d871074 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c @@ -426,6 +426,7 @@ static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value, break; i2c_acpi_register_device(adapter, adev, &info); + put_device(&adapter->dev); break; case ACPI_RECONFIG_DEVICE_REMOVE: if (!acpi_device_enumerated(adev)) -- 2.33.0