[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <IA3PR11MB89864715B359F91E993BE0C6E588A@IA3PR11MB8986.namprd11.prod.outlook.com>
Date: Mon, 19 Jan 2026 07:50:59 +0000
From: "Loktionov, Aleksandr" <aleksandr.loktionov@...el.com>
To: "Vecera, Ivan" <ivecera@...hat.com>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>
CC: Eric Dumazet <edumazet@...gle.com>, "Nguyen, Anthony L"
<anthony.l.nguyen@...el.com>, Rob Herring <robh@...nel.org>, Leon Romanovsky
<leon@...nel.org>, "Lobakin, Aleksander" <aleksander.lobakin@...el.com>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>, "Kitszel,
Przemyslaw" <przemyslaw.kitszel@...el.com>, "Kubalewski, Arkadiusz"
<arkadiusz.kubalewski@...el.com>, "intel-wired-lan@...ts.osuosl.org"
<intel-wired-lan@...ts.osuosl.org>, Jakub Kicinski <kuba@...nel.org>, "Paolo
Abeni" <pabeni@...hat.com>, "devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>, Conor Dooley <conor+dt@...nel.org>, Jiri Pirko
<jiri@...nulli.us>, Richard Cochran <richardcochran@...il.com>, "Saravana
Kannan" <saravanak@...nel.org>, Prathosh Satish
<Prathosh.Satish@...rochip.com>, Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
Mark Bloch <mbloch@...dia.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, Tariq Toukan <tariqt@...dia.com>, Andrew Lunn
<andrew+netdev@...n.ch>, Jonathan Lemon <jonathan.lemon@...il.com>, Krzysztof
Kozlowski <krzk+dt@...nel.org>, Saeed Mahameed <saeedm@...dia.com>, "David S.
Miller" <davem@...emloft.net>
Subject: RE: [Intel-wired-lan] [PATCH net-next v2 09/12] dpll: Prevent
duplicate registrations
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@...osl.org> On Behalf
> Of Ivan Vecera
> Sent: Friday, January 16, 2026 7:46 PM
> To: netdev@...r.kernel.org
> Cc: Eric Dumazet <edumazet@...gle.com>; Nguyen, Anthony L
> <anthony.l.nguyen@...el.com>; Rob Herring <robh@...nel.org>; Leon
> Romanovsky <leon@...nel.org>; Lobakin, Aleksander
> <aleksander.lobakin@...el.com>; linux-rdma@...r.kernel.org; Kitszel,
> Przemyslaw <przemyslaw.kitszel@...el.com>; Kubalewski, Arkadiusz
> <arkadiusz.kubalewski@...el.com>; intel-wired-lan@...ts.osuosl.org;
> Jakub Kicinski <kuba@...nel.org>; Paolo Abeni <pabeni@...hat.com>;
> devicetree@...r.kernel.org; Conor Dooley <conor+dt@...nel.org>; Jiri
> Pirko <jiri@...nulli.us>; Richard Cochran <richardcochran@...il.com>;
> Saravana Kannan <saravanak@...nel.org>; Prathosh Satish
> <Prathosh.Satish@...rochip.com>; Vadim Fedorenko
> <vadim.fedorenko@...ux.dev>; Mark Bloch <mbloch@...dia.com>; linux-
> kernel@...r.kernel.org; Tariq Toukan <tariqt@...dia.com>; Andrew Lunn
> <andrew+netdev@...n.ch>; Jonathan Lemon <jonathan.lemon@...il.com>;
> Krzysztof Kozlowski <krzk+dt@...nel.org>; Saeed Mahameed
> <saeedm@...dia.com>; David S. Miller <davem@...emloft.net>
> Subject: [Intel-wired-lan] [PATCH net-next v2 09/12] dpll: Prevent
> duplicate registrations
>
> Modify the internal registration helpers dpll_xa_ref_{dpll,pin}_add()
> to reject duplicate registration attempts.
>
> Previously, if a caller attempted to register the same pin multiple
> times (with the same ops, priv, and cookie) on the same device, the
> core silently increments the reference count and return success. This
> behavior is incorrect because if the caller makes these duplicate
> registrations then for the first one dpll_pin_registration is
> allocated and for others the associated dpll_pin_ref.refcount is
> incremented. During the first unregistration the associated
> dpll_pin_registration is freed and for others WARN is fired.
>
> Fix this by updating the logic to return `-EEXIST` if a matching
> registration is found to enforce a strict "register once" policy.
>
> Signed-off-by: Ivan Vecera <ivecera@...hat.com>
> ---
> drivers/dpll/dpll_core.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c index
> f2a77eb1b9916..8616d6285c646 100644
> --- a/drivers/dpll/dpll_core.c
> +++ b/drivers/dpll/dpll_core.c
> @@ -161,10 +161,8 @@ dpll_xa_ref_pin_add(struct xarray *xa_pins,
> struct dpll_pin *pin,
> if (ref->pin != pin)
> continue;
> reg = dpll_pin_registration_find(ref, ops, priv,
> cookie);
> - if (reg) {
> - refcount_inc(&ref->refcount);
> - return 0;
> - }
> + if (reg)
> + return -EEXIST;
> ref_exists = true;
> break;
> }
> @@ -244,10 +242,8 @@ dpll_xa_ref_dpll_add(struct xarray *xa_dplls,
> struct dpll_device *dpll,
> if (ref->dpll != dpll)
> continue;
> reg = dpll_pin_registration_find(ref, ops, priv,
> cookie);
> - if (reg) {
> - refcount_inc(&ref->refcount);
> - return 0;
> - }
> + if (reg)
> + return -EEXIST;
> ref_exists = true;
> break;
> }
> --
> 2.52.0
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@...el.com>
Powered by blists - more mailing lists