]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
dpll: Prevent duplicate registrations
authorIvan Vecera <ivecera@redhat.com>
Wed, 21 Jan 2026 13:00:11 +0000 (14:00 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 22 Jan 2026 16:08:42 +0000 (08:08 -0800)
commitf3ddbaaaaf4d0633b40482f471753f9c71294a4a
tree2d235c18c06991bf19c804c4bf3eac3f36fa0f81
parent27880b0b0d35ad1c98863d09788254e36f874968
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.

Fixes: 9431063ad323 ("dpll: core: Add DPLL framework base functions")
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://patch.msgid.link/20260121130012.112606-1-ivecera@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/dpll/dpll_core.c