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=1796307929; b=SP/pWOXYV3f/JJd9dgxVUVcI9UkVCd1lJcHnQA5EEBSyF0hAfw3SNOUzxAycx6/UPTDU nnDbAuv/1xabWkV4yBiLBjkRqZhrZpQ3i6++sEJ8aOXU22Of3PUsvFgM89MTmjtJcYThn DSssro/fb3sAcrJ31dpTS0j+VzjoFial5dInlWMps1rYGGSZjYAXMtYxMP4WdZ+prxt3M N4FVauDdxoaYvYYKI3Yb2m+D40IFLZQvZ/LhorF4d76sp5AvbLgnts/QsPnbps4Hq1Bes 6SYUk/osRf1IN4uhMu41RaWeAYsKpBOMtVzCOET9FADH63/CNMit3gp/oVaoFyNOZ5Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796307929; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=lQUICwEo6xprNP2zbrApeXKPEeoLw2w72D5+47d+49g=; b=gHNcakZWcEQ+ZhfVYyjpAi6RrTDMxNnQ024t5KIQBr+Gqa7SEG7VfSD8Io6259kLzZ1b 5r8vnNDTeAh4eOzt+G5Z3FY7iTGPWeC4lr37WuJLUESEHBR0yeMqYW7NcbYGb0hW4GkG9 Nk21G4A/ph3Lh88Cnk/XOpAs8vlniMYFsTDqlP1FZIFygJCZVfczPzC5O622tEV54q5QN owJ4ekj96inkz9BrgDQFDKAEBC3zLokU5jzkVwOd/nxWUqHZYAzN7ZvSiqw0NlxLNy48Q xXkBREcPnOkpYjh+LKyo2T9sQLE5Kpv3sywT9UIm6T8IEM3Pm/E8D+yJ71H6eJn5XnQ== 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="NKzBz/jE"; 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 15086606A322 for ; Thu, 3 Dec 2026 14:25:28 +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=NKzBz/jE Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B8231F00896; Thu, 3 Dec 2026 14:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796307928; bh=lQUICwEo6xprNP2zbrApeXKPEeoLw2w72D5+47d+49g=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=NKzBz/jEy9/H+ebyX760mSG/fHCg6B/YjC+HaNzHhf4TfQj2ugffUvleEJuulkbF1 /9wyBek+NHfAv/z02ajprSyxU4b65Xwe3R5ly9bZQp5BpC6rPqGTU7P45LyaMp6x5I ng1b9TM+lMEbVGc5av2sbupxd8Yj+IcJFJO4oNKb7RJxZYksOfFB1YOoaAb6wvfvgV KmhjNk2ncZqMxlRDTgTtDYMkXaMqRFKABFxgIBcTj27XXsV+F99smnbSUNs7xprXPr 2Ixp3kRDIb/JpSSk6P40Mr6qhep2t/lxMn3znhXq70C90Lt93js+oaYHOBaZNq5ZRW 96QiCQrHZ4j7g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v1] usb: typec: tcpm: Clear pps_data in tcpm_reset_port() Reply-To: sashiko-reviews@lists.linux.dev To: "Kyle Tso" Cc: linux-usb@vger.kernel.org In-Reply-To: <20261203140023.2275666-1-kyletso@google.com> References: <20261203140023.2275666-1-kyletso@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 14:25:27 +0000 X-Mailing-List: linux-usb@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: - [Low] usb: typec: tcpm: unsynchronized early pps_data memset in tcpm_reset_port() -- commit 07c97444e7154a6e5c8ed5b6cc157c2333dc910a Author: Kyle Tso usb: typec: tcpm: Clear pps_data in tcpm_reset_port() This commit clears the entire port->pps_data structure in tcpm_reset_port() instead of only clearing port->pps_data.supported. > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index ca38e05f831a7..72b08d69ff808 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -5178,7 +5178,7 @@ static void tcpm_reset_port(struct tcpm_port *port) > tcpm_typec_disconnect(port); > port->attached =3D false; > port->pd_capable =3D false; > - port->pps_data.supported =3D false; > + memset(&port->pps_data, 0, sizeof(port->pps_data)); > tcpm_set_partner_usb_comm_capable(port, false); > =20 > /* [Severity: Low] Can clearing port->pps_data here cause tcpm_psy_get_online() to transiently report TCPM_PSY_FIXED_ONLINE during a PPS detach or reset? tcpm_reset_port() clears port->pps_data.active before sleeping TCPC bus calls (set_pd_rx() and set_vbus() in tcpm_init_vbus()) and before tcpm_init_vbus() sets port->vbus_charge to false. Because tcpm_psy_get_online() does not take port->lock, a concurrent power_supply reader can observe the intermediate state: CPU0 CPU1 tcpm_reset_port() memset(&port->pps_data, 0, ...) set_pd_rx(..., false) tcpm_psy_get_online() port->vbus_charge =3D=3D true port->pps_data.active =3D=3D false <-- returns TCPM_PSY_FIXED_ONLINE tcpm_init_vbus() port->vbus_charge =3D false Separately, struct pd_pps_data places min_volt, max_volt, and max_curr before active, so memset() zeroes those fields before clearing active. Concurrent lockless readers such as tcpm_psy_get_voltage_max() can race with this memset() and observe active as true with zeroed or torn bounds. Clearing port->pps_data after tcpm_init_vbus() would avoid the TCPM_PSY_FIXED_ONLINE window once port->vbus_charge is false. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203140023.2275= 666-1-kyletso@google.com?part=3D1