From nobody Sat Feb 7 17:20:07 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 B51AF481AAF for ; Wed, 21 Jan 2026 13:00:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769000430; cv=none; b=iEfHr2trBOgfHHNLmbU7VRGcxExDqLXAngtRgjNnxPzb/y4KrgZ45aDorkQUt+hMfE11gttHDUV/IIgocrSxgauNDEospMHg+XbJJUHkgIWDu34x6lB87UyNUdEIlt4Wz++KPBrnu44uo/TFzz6GqItcNdWToL+k9WnED11XQ7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769000430; c=relaxed/simple; bh=bUu43LQgT8yAOzAl+/u9fJOsAD/+bXQRvmZtMsuwt2o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=W+i7CKN491bz6Opm61ILrP/KK7pUg/HiAMCSFC95oSSVhevQ5yl6m1/jlajNr7fdrDx18Mc1vIUqx8FXYg3YnpDhgGjlB4qYn4i/ftAOen8osG12bEBhlwLFLqOr9l9rDKnvF2kPWA+zTof+KS3hmxSq7oDByzokpRm2jXCG9Ac= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=FXniz+l/; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FXniz+l/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769000427; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=07keXz77xMZfJHIoYajXfcSDc0qFVlaNkmTnOeD+/10=; b=FXniz+l/R/GmyiKj5N57Qe44xWIOcOXwYNfCjl5uORZO7svNoBbJ78rviClnTmR/WEEYPV 6cu6H20Tkp9E47e3Ag7hHKNqUxTFNo4YEZtD4X0t2m3EnJ8geRCeG8czkWkf1DT8zrhU1k EnRIE/uvv2OY8F2LYyrFlZSod+VrdaU= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-5-66WmoPQrOxSCBRIXBfjNdQ-1; Wed, 21 Jan 2026 08:00:20 -0500 X-MC-Unique: 66WmoPQrOxSCBRIXBfjNdQ-1 X-Mimecast-MFC-AGG-ID: 66WmoPQrOxSCBRIXBfjNdQ_1769000417 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DCB751955F06; Wed, 21 Jan 2026 13:00:16 +0000 (UTC) Received: from p16v.redhat.com (unknown [10.44.32.187]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9F0AF19560A2; Wed, 21 Jan 2026 13:00:13 +0000 (UTC) From: Ivan Vecera To: netdev@vger.kernel.org Cc: Vadim Fedorenko , Arkadiusz Kubalewski , Jiri Pirko , "David S. Miller" , Michal Michalik , Milena Olech , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net] dpll: Prevent duplicate registrations Date: Wed, 21 Jan 2026 14:00:11 +0100 Message-ID: <20260121130012.112606-1-ivecera@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" 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. Fixes: 9431063ad323 ("dpll: core: Add DPLL framework base functions") Signed-off-by: Ivan Vecera Reviewed-by: Arkadiusz Kubalewski Reviewed-by: Vadim Fedorenko --- 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 a461095efd8a..8879a7235156 100644 --- a/drivers/dpll/dpll_core.c +++ b/drivers/dpll/dpll_core.c @@ -83,10 +83,8 @@ dpll_xa_ref_pin_add(struct xarray *xa_pins, struct dpll_= pin *pin, if (ref->pin !=3D pin) continue; reg =3D dpll_pin_registration_find(ref, ops, priv, cookie); - if (reg) { - refcount_inc(&ref->refcount); - return 0; - } + if (reg) + return -EEXIST; ref_exists =3D true; break; } @@ -164,10 +162,8 @@ dpll_xa_ref_dpll_add(struct xarray *xa_dplls, struct d= pll_device *dpll, if (ref->dpll !=3D dpll) continue; reg =3D dpll_pin_registration_find(ref, ops, priv, cookie); - if (reg) { - refcount_inc(&ref->refcount); - return 0; - } + if (reg) + return -EEXIST; ref_exists =3D true; break; } --=20 2.52.0