From nobody Fri Aug 14 15:49:49 2026 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B34F446A611 for ; Fri, 14 Aug 2026 13:40:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786714835; cv=none; b=VgoXj6opt30muqChgB9Ng7ZGChmN+aoBT9RYC1N/VWVbo8uYdgee7Widr6eH/IK3OdFxE0RzIH9DTaucJydmDTLh8MJl+dyu0WnJtSLOPrYCfmJM1JNziipLXRhaZzth+YbsFwTFzqR6G4Cm4FhoCcw+RqX8NODgLz68Bjm9488= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786714835; c=relaxed/simple; bh=53qZ6EOHdbjTwra2c5Sv9TSDD++BFIIDst4W9Sft7xo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=CijNE7ZmWFyGThHXeO9XHOtMt9fN8t5VoHvM8UUKCgZqHq52OeeqfJfRm9Kxu0zzwVzNTBH6xiX/UHMqjiOqBzJpj+POHRrmAjLn6Dqw+Fxwv+nWVOOR5fMmsZ/Fm08KT4A5E7GxqjGfrE8BgRNxgiuPbft85+g4fjt2/7CqqIQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JmACz9g4; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JmACz9g4" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-848593533cbso55725b3a.3 for ; Fri, 14 Aug 2026 06:40:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786714833; x=1787319633; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=MYY0ZppMV8SjlgzMBgbRNb25AoRNuZQE59rlaLfzn4s=; b=JmACz9g4yIJ8v58njoSd70b1dBfnP33L3qBV0P0fsAYGB0ec1O9BE5j2W166uCH9Ob /wRfwB1FflD3ZGWuWA/rei/atEgmqW7HcqOANtewiX4I+Ogl8IZKMw2emSjGou3WOSJ0 O7qvJP6DjU4RofHbEZv2AmXcSd7ZkcU6jTaf7YGUzGPEVH75y/yBOCAstpHIT8of75W+ nPnBwQASUOq2YK8p79+5f3HAQD4LjmWwXQ2HRUKb6lC4yitglgeQSiO2oKJnaf0H7fYU flKgFB3eaV8anAtknpYDkt51i4gdybFdYytcUOFFC7eRexj8YJ3rvRcgcvFMe0+72I1j jDzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786714833; x=1787319633; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=MYY0ZppMV8SjlgzMBgbRNb25AoRNuZQE59rlaLfzn4s=; b=ZVefuM8KCAJeh0zsSrPnQwznnZazaxgnVqUS/oorhdIA5rFy45KwDH073YB0Rg/CUR JPhfDW3RRAZ61aT0TgAyFcYhwiQAxnUbFfHVfGkhqIMdx+3cfx51u74zLxWlwVmttrSU kkT/uiUuTzB6i8tX5X30Xv41EX0xGF3ykCdfgpI2rnNivxrkcJs5KaEEgCq379WpfXLL AbLbABgF0baU1Aq56EZiDbY2WXumFOhc4XazxWYJKButvvfsyFhtVMzbf+L2vGIGfKw4 jSGNEYep1qZIWB22HXa8DtPCZM04uyk+lf09njblf1P6etNQ1vqCsJ8nq25rfS8bYufN pCiA== X-Forwarded-Encrypted: i=1; AHgh+RrPNJA/M5X1Fjoptyjek/Cs9Vv0EFxW+R7sarreLFJ3/X+uHT5KvgydZnW4aXHrNk+fDOZOV6kcbah6Ga4=@vger.kernel.org X-Gm-Message-State: AOJu0YxO3R1zNqG6LwsxA+GgS5PvKYa73CqExDBy+w6FLqbzJvNXxTnk f++h4fRavSAfqkp/qKREZpvZRPXOlyhDpmTY5f4LtthPNSufBAKOTVoG X-Gm-Gg: AR+sD13E5fUn3MQqoI5fQq3wM7oB8epXXMB8G8e/EQSoyJya5ROAwdwtfl8S77tcr1h KjxuiQWJQVazHJNW3F5OOB0HbtXl15ATxGuTFgF32Kkn0W2l5wey4uvZrv30dhGQToxPA1CuT0h 1mK1twlABGou1dOgj1d0Vx1Vst9wzuJ3oeaCE+BvEqil08WofTEAYPGFXaBbmy44IEbFpFjaDat fIjO1Dw1h2aJTwtnoR8p0g2tcXuMo9DhTQVkI4nUfZdZrUpcTotyQXtdAqSJMYv0aunw4nixM2D cwG39XWlXaSXqaM/c05dfIPhZKlNnViA6FxfDqSx+wVKVQX4FD8icx3CET8bPDLzFBso3QS0bkj brIeXm5g1Bon6AWMZxg2IJ1AUNKevBcoQ5q3AY7xQdX8AsOXH8fwj1EWbJ7E+XQPjJIFZ6XcmCt nzkPO9x7TCOXj5FiPxtGXa4A7v4iqqQQnhsQ3f6VNdREM9L+5K6XHv75d2vyeLMPd9/rNgxMgfa 267f66Z+s04K1JJDHE= X-Received: by 2002:a05:6a00:4fd5:b0:847:8650:69c7 with SMTP id d2e1a72fcca58-84fde521f57mr5562130b3a.21.1786714832956; Fri, 14 Aug 2026 06:40:32 -0700 (PDT) Received: from haichao.tail057a43.ts.net ([2001:da8:e000:1206:e9af:7c0e:be31:2c3f]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cc095a20e79sm627049a12.20.2026.08.14.06.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2026 06:40:32 -0700 (PDT) From: Ruoyu Wang To: Alexandre Belloni , Frank Li , Boris Brezillon , Greg Kroah-Hartman , Arnd Bergmann Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, Ruoyu Wang Subject: [PATCH] i3c: master: Release I2C boardinfo node reference Date: Fri, 14 Aug 2026 21:40:27 +0800 Message-ID: <20260814134027.1386818-1-ruoyuw560@gmail.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" of_i3c_master_add_i2c_boardinfo() takes a reference to each Device Tree child node so the fwnode stored in the persistent board info remains valid. i2c_new_client_device() later takes its own reference for the client, and client teardown only releases that reference. The original board-info reference is therefore leaked for every DT-described I2C device. Registration failures after bus population leak it as well. Register the board-info node reference as a managed resource of the I3C master. This retains it for the full board-info lifetime and releases it on both registration failure and normal master teardown. This issue was found by a static analysis checker and confirmed by manual source review. Fixes: 3a379bbcea0af ("i3c: Add core I3C infrastructure") Signed-off-by: Ruoyu Wang --- drivers/i3c/master.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index f1be38a640ca1..8063e2642cbda 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -2619,6 +2619,11 @@ EXPORT_SYMBOL_GPL(i3c_master_do_daa); =20 #define OF_I3C_REG1_IS_I2C_DEV BIT(31) =20 +static void of_i3c_master_put_node(void *data) +{ + of_node_put(data); +} + static int of_i3c_master_add_i2c_boardinfo(struct i3c_master_controller *master, struct device_node *node, u32 *reg) @@ -2648,8 +2653,12 @@ of_i3c_master_add_i2c_boardinfo(struct i3c_master_co= ntroller *master, /* LVR is encoded in reg[2]. */ boardinfo->lvr =3D reg[2]; =20 + ret =3D devm_add_action_or_reset(dev, of_i3c_master_put_node, + of_node_get(node)); + if (ret) + return ret; + list_add_tail(&boardinfo->node, &master->boardinfo.i2c); - of_node_get(node); =20 return 0; } --=20 2.51.0