From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796041153; b=hTp5aUYRT12qZGcuAPs12GU3SOqAbIN3bKI5NsUeOdPdSW8ZvhvuRIBTFK3faG6m9h9M Tkj+Xudbwq+zHNq2kxGClU/sCKTag0FHWDKsEbBPtTvpykE4qTpv/F4SDTl4y25umNHdy 4NiqiX28ZpnpryjsTOyW1STqPdv/5oy47yDPBKAo5DBOgL9/CUk/9etSHecFa1XvCcpzP BMdtuDHu6mdgN5rGkGPNgg02MRdierIOtzwVqhHDGTYFhxFoL8MMBAdt3Xh0UEICxzCEE HpiSdXBdVA/mfw9mvsrSWdqwi8ohPDC4O0hDG8QVvn/abpgL+nc0ZDo2thfebBsVWcw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796041153; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Date:From:To: Cc:Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=aun3qAWGfRMv1/g1sXVW+d6BATCPseY1cVLweWCMfyY=; b=RT3s5ra5GPXrb+0WxEnxcsnpFSWFR8/SUlWFm5lZYBbL8U5v+E1u3iQW7CwO+5mRkF+z HSXxKPtjna5ULhazhR6qEavrdke/w2rLgUyi8PP92hCPdkpQBCHWxo+C/Hbfi+jnzRNVN Xtj7XjOS0ewp1NBOpdAaxiPte+Ewk7jxaKrMB6eJhxPMbJHBkmh5gV4YnLfD748B1sr69 AN1N6LoaWoj2AFfxep6jrZbPf2G4VUB4/02Ug0uZCzVnOODVMyEStQpUxXM3k6OIM4aQn uUY+3RJUE+ZF2ij4Ym3D5GDexA7ezyLZ2ulT+OfNRvRwQn1OD+8WlsRkJR/qJjXy/cw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b="b7jBj/Zd"; arc=none smtp.remote-ip=198.175.65.18 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE5DB606A31C; Mon, 30 Nov 2026 12:19:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DE5DB606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=b7jBj/Zd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796041153; x=1827577153; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=aun3qAWGfRMv1/g1sXVW+d6BATCPseY1cVLweWCMfyY=; b=b7jBj/ZdfJ1dpgQclS7m4wUOrwpgrfbMf2jRnvimJ/72gq+ZtaHlCD7x 6q5P7VN7Qkyp4rHDLOmRkU70Cm2fA2wjBwhx5e4Hhl+4eKGMLBMVSDtjz FopFqC6cxajQg69TAg5N/Ss3fdbuLtNEzg2c589pV5y5X843X3hLeR4eq 7V4FYYEUhYKS/dJe8L3peLdUOGRgG6+/Lij0+8dJ7oyHGDaqRpmwQDywg ix4PJTr6SQ1k4nRFtwNBVpAE7Q3CGUS/wpn2IT15Y7cLUU77r4RluYAIA nXjDEEJP14grZQj4awc8cfnX+SBXDbdNYf3C3uxDFSEOGsUyHFjHn1bYG A==; X-CSE-ConnectionGUID: wh5azN3bSJ+4AybIl7rD8Q== X-CSE-MsgGUID: GJa9suyhSY27L7MiD+IuYQ== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4872535" X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="4872535" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 04:19:13 -0800 X-CSE-ConnectionGUID: LmvjCgKPRLWJuc2dxXA3+g== X-CSE-MsgGUID: UdCVjd8qSKa0AKjPK5pENw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="13296040" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa009.jf.intel.com with ESMTP; 30 Nov 2026 04:19:11 -0800 Received: by black.igk.intel.com (Postfix, from userid 1008) id E5FA598; Mon, 30 Nov 2026 13:19:09 +0100 (CET) Date: Mon, 30 Nov 2026 13:19:09 +0100 From: Heikki Krogerus To: Neil Armstrong Cc: Badhri Jagan Sridharan , Greg Kroah-Hartman , Guenter Roeck , Igor Paunovic , linux-usb@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 2/3] usb: typec: tcpm: unregister stale partner sink capabilities Message-ID: References: <20261125-topic-tcpm-core-fixes-v2-0-aede2a3471f4@linaro.org> <20261125-topic-tcpm-core-fixes-v2-2-aede2a3471f4@linaro.org> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261125-topic-tcpm-core-fixes-v2-2-aede2a3471f4@linaro.org> On Wed, Nov 25, 2026 at 11:40:18AM +0100, Neil Armstrong wrote: > tcpm_register_sink_caps() registers a new "sink-capabilities" device > under the partner USB PD object every time a Sink_Capabilities message > is received, but the previously registered one is only removed on > detach. > > sink_cap_done is cleared on Hard Reset, so the sink capabilities are > queried and registered again on the same partner: registering a second > device with the same name under the same parent fails, and the stale > capabilities stay exposed in sysfs. > > Unregister the previous capabilities before registering the new ones. > > Cc: stable@vger.kernel.org > Fixes: 8203d26905ee ("usb: typec: tcpm: Register USB Power Delivery Capabilities") > Assisted-by: LLM > Signed-off-by: Neil Armstrong Reviewed-by: Heikki Krogerus > --- > drivers/usb/typec/tcpm/tcpm.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index 20e18bca649e..d0abe8100742 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -3559,6 +3559,11 @@ static int tcpm_register_sink_caps(struct tcpm_port *port) > struct usb_power_delivery_capabilities_desc caps = { }; > struct usb_power_delivery_capabilities *cap; > > + if (port->partner_sink_caps) { > + usb_power_delivery_unregister_capabilities(port->partner_sink_caps); > + port->partner_sink_caps = NULL; > + } > + > if (!port->partner_pd) > port->partner_pd = usb_power_delivery_register(NULL, &desc); > if (IS_ERR(port->partner_pd)) > > -- > 2.34.1 > -- heikki