From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796526064; b=Kqq3Hp49vqNp08aKG+YPZnf5psyoBdyjR/3CxAXbgdQH4yhKqqKIu/eqg21taaLQaw7u U0S1jYS4iL4XDy+O7oCLsrTGjZMgJUpH6QMZOeJrIu4rXvL2cP/IXdtjeEN9MH+QmsheP jD1ucKgwubsxjuSt3EKikVPgR8BnT3rMkml76DnpI0T2ZWuJXlx6q7SlplQZZ7u+GUUSu ucDb83JLiw0/FNxfdeHoX/BspBWXnhzy61KsybrGwGDlxoZHPFre39eQuGdbg/3TtOwnq 5phce2X8VAfQKEQf0shEE5F67rJEBSmtC/pNcTMJ3AZezSqsR7x/CylKEccVmA3Adpw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796526064; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=vVKPNh9fTBbTwThKvZcFmJlGyFroX5b8JL+FRu2v9h4=; b=Z5bJ0U1cXotZpFwtm6PEvQ7YPV0PYDlu6Tou0tkL4vuBMaF8yjog1SpGPlHMhHExS7DP 1ySjYNPc+DxdedqDnhcgDj//t5VxNk0jO+m/Jb8Vr+d1I98KW2M/LalNMWpRhslqZBYbU +Dc80/LaJVLi+ryE1pcSsAASJGe9zAD+pXsJBShngd+cDVcPKmpCYJQzjuI2An2doxd0z XdLCt1ogdsPX15WgL7sizgpHouwnk8UuBFKxQBa/oOqJMx+uuQo/CbasRLf+L9dp+4nLu Z8cWKwZACqVBWVLYrRZD+1vAz7uYxMTaEA5ZOIXNYwVFDVWezZ8EokFBT8Eqoy7WW8w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=G70sXVjc; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0851C606A31F for ; Sun, 6 Dec 2026 03:01:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=G70sXVjc Received: by smtp.kernel.org (Postfix) with ESMTPSA id C23511F0093B; Sun, 6 Dec 2026 03:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796526063; bh=vVKPNh9fTBbTwThKvZcFmJlGyFroX5b8JL+FRu2v9h4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=G70sXVjcxkSbpFTFHyOdJVMspJCWhGg9PR1+13biSGDf5QCxj9x7kxpPzBp01Gx0L WoUlj3ppL7LYBKp+dQTX3an9KSn6pcI0DU9lSPuSUyB48gOxyN6hTHFftEKQzwFzaS 8VmtNVbd35hY1uZkyk/4XelWCh4z8b0hqXUNoOXbcY8DHHh0fAEwy6GcRZmfQNHI0L HF3ffI69BR3amqj4M5bq7OnEhKf07m11FyyGpLLRSCyD2Kt3iBpELSKIrT/HjPeZIa yNwW0CjKN/LiHo1y0SvJmRqbp+PDV1ztPNMeAN6nmaLEToESEeampHIqT1pDPjMllr GjSdgkdeecBxQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 1/2] component: release match data on add failure Reply-To: sashiko-reviews@lists.linux.dev To: "Zhiqi Zhang" Cc: dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org In-Reply-To: <20261206024833.37825-2-zhiqizhangg@gmail.com> References: <20261206024833.37825-1-zhiqizhangg@gmail.com> <20261206024833.37825-2-zhiqizhangg@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 03:01:03 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] component: double of_node_put() in ASoC codecs on match add failure -- commit 0683b7fafbae8a82c09ea4152d6cf8bee316a38f Author: Zhiqi Zhang component: release match data on add failure This commit invokes the match release callback in __component_match_add() when allocation fails or *matchptr already holds an ERR_PTR, and returns that error from component_master_add_with_match(). > diff --git a/drivers/base/component.c b/drivers/base/component.c > index 655d68deb590c..6b84ce958140d 100644 > --- a/drivers/base/component.c > +++ b/drivers/base/component.c [ ... ] > @@ -387,13 +395,16 @@ static void __component_match_add(struct device *pa= rent, > { > struct component_match *match =3D *matchptr; > =20 > - if (IS_ERR(match)) > + if (IS_ERR(match)) { > + component_match_release(parent, release, compare_data); > return; > + } > =20 > if (!match) { > match =3D devres_alloc(devm_component_match_release, > sizeof(*match), GFP_KERNEL); > if (!match) { > + component_match_release(parent, release, compare_data); > *matchptr =3D ERR_PTR(-ENOMEM); > return; > } > @@ -409,6 +420,7 @@ static void __component_match_add(struct device *pare= nt, > =20 > ret =3D component_match_realloc(match, new_size); > if (ret) { > + component_match_release(parent, release, compare_data); > *matchptr =3D ERR_PTR(ret); > return; > } [Severity: Medium] Can this cause a double of_node_put() in existing callers that drop their device_node reference when *matchptr becomes an ERR_PTR? Previously, __component_match_add() left compare_data to the caller on allocation failure. Three ASoC codec drivers rely on that and still drop their rxnode/txnode reference on IS_ERR(*matchptr): pm4125.c, wcd937x.c, and wcd939x.c. sound/soc/codecs/pm4125.c:pm4125_add_slave_components() { ... component_match_add_release(dev, matchptr, component_release_of, component= _compare_of, pm4125->rxnode); if (IS_ERR(*matchptr)) { ret =3D PTR_ERR(*matchptr); of_node_put(pm4125->rxnode); pm4125->rxnode =3D NULL; return ret; } ... } When devres_alloc() or component_match_realloc() fails, __component_match_add() now drops the single of_parse_phandle() reference via component_release_of(), and the driver then calls of_node_put() again, causing a refcount underflow and use-after-free under CONFIG_OF_DYNAMIC. Updating those three callers (pm4125_add_slave_components(), wcd937x_add_slave_components(), and wcd939x_add_slave_components()) along with the component_match_add_release() kernel-doc would avoid this regression. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261206024833.3782= 5-1-zhiqizhangg@gmail.com?part=3D1