From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2B45282F0A; Fri, 17 Jul 2026 14:14:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784297661; cv=none; b=qS39Lt6pV1OmnP5cjFWm2vlrcHJ/2+m83WoKKD0xRxpZKAq5jV9HCsBNlvKfx2FF1szFwCc44ziEzzXoUUBO4wCHlXGpihNNMCxM9QItIx8rA+DVWJk0rbzrU23Y42r2aRoOpVVNaaOpIZc+XBugB8yyKaM+c13SxPXG4ndNGi0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784297661; c=relaxed/simple; bh=mAnjIlL8AIdTHsGjDYrxj6vC2VhSyuTI77mskkCxabk=; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Date: Message-Id; b=f9tnJu13ngWdcQ4JldeZcpnJ8kxeXWaLzjAyUWpg8omiUf8ILHI0GLzbLGtC2/9AdJkqG2u9ahEZkytDUnD0liv6WnofxpqqQUIcpYKRiV/TJCLbN65TVLvPnYb5DxvJFjoNC5JQKlFi8dtewMVZ0MFe+NNIlNAsufOLrv/8W50= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UO7rqgSz; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UO7rqgSz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2500C1F000E9; Fri, 17 Jul 2026 14:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784297660; bh=QGEPxinQPATW4/n79/tOeVM9ZGeVG81OvW++RWAT+Xs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=UO7rqgSzBtNxk+2IoFOo0+3sUeooTZq5i8IC5ToW2Xft4u/E60NeX3DAKtXCQsebl aJuhLtZiobGg90rQaG+qnGOc6NbasfJA7xNvUzv30bXoeEQR7NnLUcH5jZx6dxt5bO Qr+6NyLc7mwppJaPTZzChgOB4zj6JSsUgPxKG57FFWw11707sqO62g4vFXCPXLlaD+ kvDpYSf/8KXwso6+UxsGP1Vkk/zzLuad0p9IUbyhdXUTEfJEeHCV2gRQ6OSBClVP4P eC5YJlwWFjWlfGcNb3gNB7yjOHZE2sjbNul+ooUUbundHTz2wUYya7SZOjsK976ChM /d3yO4FHkYtHw== From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 4/4] drm/panel: find_panel_by_fwnode() return a counted reference Reply-To: sashiko-reviews@lists.linux.dev To: "Albert Esteve" Cc: Frank.Li@kernel.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-sunxi@lists.linux.dev, wsa+renesas@sang-engineering.com In-Reply-To: <20260717-drm_refcount_wiring-v3-4-023900c32e01@redhat.com> References: <20260717-drm_refcount_wiring-v3-0-023900c32e01@redhat.com> <20260717-drm_refcount_wiring-v3-4-023900c32e01@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 17 Jul 2026 14:14:19 +0000 Message-Id: <20260717141420.2500C1F000E9@smtp.kernel.org> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: Pre-existing issues: - [High] TOCTOU race condition in `drm_panel_add_follower` leading to Use-A= fter-Free of `panel->dev`. -- --- Patch [4]: [PATCH v3 4/4] drm/panel: find_panel_by_fwnode() return a co= unted reference --- commit 2c073e53f181794d94244eff0882b1f1a661d995 Author: Albert Esteve drm/panel: find_panel_by_fwnode() return a counted reference This patch updates find_panel_by_fwnode() to return a reference-counted drm_panel pointer, preventing the panel's container memory from being released prematurely. It also updates drm_panel_remove_follower() to balance the reference with drm_panel_put(). > diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c > index 72cf86253c0cd..a00ae98ed0956 100644 > --- a/drivers/gpu/drm/drm_panel.c > +++ b/drivers/gpu/drm/drm_panel.c [ ... ] > @@ -554,6 +560,7 @@ static struct drm_panel *find_panel_by_fwnode(const s= truct fwnode_handle *fwnode > =20 > list_for_each_entry(panel, &panel_list, list) { > if (dev_fwnode(panel->dev) =3D=3D fwnode) { > + drm_panel_get(panel); > mutex_unlock(&panel_lock); [Severity: High] This is a pre-existing issue, but does releasing the panel_lock here leave a TOCTOU race window where panel->dev can be freed before it's used by the caller? If the panel's device is unregistered concurrently (e.g., via sysfs unbind of its parent), the following sequence seems possible: CPU1 in find_panel_by_fwnode(): drm_panel_get(panel); mutex_unlock(&panel_lock); return panel; CPU2 concurrently unregisters the device: drm_panel_remove() runs, removing the panel from panel_list. The device's reference count drops to zero and the struct device behind panel->dev is freed. CPU1 in drm_panel_add_follower(): get_device(panel->dev); Since panel->dev now points to a freed device, could this cause a use-after-free? > return panel; > } > } --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260717-drm_refcou= nt_wiring-v3-0-023900c32e01@redhat.com?part=3D4