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=1796130907; b=w+lqO5HxaWzhfrpGEIcaVnKkGqCmyv4YXx7v21AWuefVBsPcSRE42J0EHYlOb7qZfcwd Mry6zF8VLRtf1GwepLwQYSVZu0gBhiPGA+YAmuXhZhSTtFMBp4uDmM21YF4tbObiVS+K2 bTFg9BQzC512lgqQEWOh6FCsb1fCa30rX/jv6fGqK9EQzoh8Q1zEp7I/XNxW30zgjd0vv j+p8IWJVz7KPeLwI+QS7P1Jgxyc1Ea7fgYvQhG4d9tT2x8H24tu4MS1Qp771LkNYheQM7 ZnBOrrKIXb/UGZN0fl+NcpEFfnjnvJT2Cttekq2iBTF/A0S3vwT5fNPYEY2zCQEjk5w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796130907; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=La21drGD2YAoTQLjij2WrBQIdP5t7aaEOCCNHiuYNsQ=; b=mmp/tIGczAut/6qqhe/OqwRGwAhOH/hp+mXJLSJFGs0RAcuyOMm22i+Ahau/B8QvEbHI t3pz6bY+r2FUtmq0S7AlttHGBGnOA3+UVekaSgm1VKgB4iwDRfU1PVvF7bG4cLxeQx+pJ xwk/PcPFYw/TSk4jPofiELyQ1LC8iBa6FX2myny+KCGIWnmFUaE8EF3ZK0s6/0GscPqxf Q4MjJ+neI8evLkxv2bk0ulAAzokfPK4IZpz6FB8CmMfwSTKohf1S8kUvKLMQcxdEOfaLF Lc2XYOJF9Y7R3oS6a3smLgeaIHtKCjivDbo5B7ob2rPnj4qiZoBCYbWYnDptYVO6w8g== 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="I5NlByW/"; 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 E23CE606A31A for ; Tue, 1 Dec 2026 13:15:06 +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=I5NlByW/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F74E1F000C1; Tue, 1 Dec 2026 13:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796130906; bh=La21drGD2YAoTQLjij2WrBQIdP5t7aaEOCCNHiuYNsQ=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=I5NlByW/NiFQsiZLJ75+Go4tsbZeZn8YqogOGwUw9KgtPoN1fe9aEdc/ZT9w3HOD8 kndO7e6ce2+Vt4P8iSHVob9oliUz/GT7nsYua/LKi4dJ8y2tis54CEn1Lr/stp43Tj R4NriFsZ1Zd96/0d1SrlV2vCcaJOdMRObqYoNF5KJoMo0aogafxOivnSvXNRimytya uVOsuqb+GWQhZw+/ODjpcnlo9CRGPmIq/slAd1uc5loOXIwWH4b42ML1g2wgCs2ehl 6OxAIwWBubwtPO7ZqLMcBkIKJG6qeE2oyiBHvX8HGG6nuQy9ZXAepa5sPcnl1ungK7 L8sSHJ05WBIQA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v16 4/4] reset: Leverage revocable for accessing struct reset_controller_dev Reply-To: sashiko-reviews@lists.linux.dev To: "Tzung-Bi Shih" Cc: linux-gpio@vger.kernel.org In-Reply-To: <20261201130303.14530-5-tzungbi@kernel.org> References: <20261201130303.14530-1-tzungbi@kernel.org> <20261201130303.14530-5-tzungbi@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 13:15:05 +0000 X-Mailing-List: linux-gpio@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] reset: race in reset_controller_unregister() breaks reset_control_acquire() -- commit 898d975d7b1e8a5978d7e104db12ced65e4b60a4 Author: Tzung-Bi Shih reset: Leverage revocable for accessing struct reset_controller_dev This commit replaces the per-handle SRCU instances in struct reset_control with a single reference-counted struct revocable allocated per reset_controller_dev. > diff --git a/drivers/reset/core.c b/drivers/reset/core.c > index 0bff49d9b5586..afc17a3c698af 100644 > --- a/drivers/reset/core.c > +++ b/drivers/reset/core.c [ ... ] > @@ -197,27 +197,29 @@ void reset_controller_unregister(struct reset_contr= oller_dev *rcdev) > * Numb but don't free the remaining reset control handles that are > * still held by consumers. > * > - * Hold a temporary reference on rstc before clearing rstc->rcdev: > - * once rstc->rcdev is NULL, a concurrent reset_control_put_internal() > - * will not acquire rcdev->lock and could otherwise free rstc. > + * Hold a temporary reference on rstc before revocable_revoke(): > + * once revocable_revoke() clears the resource pointer, a concurrent > + * reset_control_put_internal() will not acquire rcdev->lock and > + * could otherwise free rstc. > */ > list_for_each_entry_safe(rstc, pos, &rcdev->reset_control_head, list) { > kref_get(&rstc->refcnt); > - rcu_assign_pointer(rstc->rcdev, NULL); > list_move(&rstc->list, &reset_control_head); > } > } > =20 > /* > - * Run synchronize_srcu() outside rcdev->lock to avoid a circular > + * Run revocable_revoke() outside rcdev->lock to avoid a circular > * locking dependency with paths that acquire rcdev->lock inside > - * the rstc->srcu read-side critical section. > + * the revocable access critical section. > */ > + revocable_revoke(rcdev->revocable); > + revocable_put(rcdev->revocable); [Severity: Medium] Can moving all handles off rcdev->reset_control_head before revocable_revoke() allow a concurrent reset_control_acquire() to succeed on an already-acquired exclusive reset line? Previously, rcu_assign_pointer(rstc->rcdev, NULL) was executed under rcdev->lock alongside list_move(). Now the resource pointer is not cleared until revocable_revoke() runs after rcdev->lock is dropped: CPU0 CPU1 reset_controller_unregister() reset_control_acquire(rstc) revocable_try_access_or_return() // gets valid rcdev lock(&rcdev->lock) list_move(&rstc->list, ...) unlock(&rcdev->lock) lock(&rcdev->lock) // rcdev->reset_control_head is emp= ty rstc->acquired =3D true; <-- bypas= ses check unlock(&rcdev->lock) revocable_revoke(rcdev->revocable) Because rcdev->reset_control_head has already been emptied, reset_control_acquire() does not see the other exclusive handle with rc->acquired =3D=3D true and returns 0 instead of -EBUSY. If the second consumer then calls reset_control_reset(), reset_control_assert(), or reset_control_deassert() before revocable_revoke() clears the pointer, it can also manipulate the reset line while the first consumer still holds exclusive control. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201130303.1453= 0-1-tzungbi@kernel.org?part=3D4