Skip to content

(master) xf86Wacom: release fd reference if wcmDevStart() fails in DEVICE_ON - #20

Open
metux wants to merge 1 commit into
masterfrom
pr/master-xf86wacom-release-fd-reference-if-wcmdevstart-fails-in-device-on-_2026-07-07_13-39-22
Open

(master) xf86Wacom: release fd reference if wcmDevStart() fails in DEVICE_ON#20
metux wants to merge 1 commit into
masterfrom
pr/master-xf86wacom-release-fd-reference-if-wcmdevstart-fails-in-device-on-_2026-07-07_13-39-22

Conversation

@metux

@metux metux commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The DEVICE_ON case calls wcmDevOpen() (which takes an fd reference,
incrementing common->fd_refs) and then wcmDevStart(); on
wcmDevStart() failure it jumped straight to 'out' without undoing the
wcmDevOpen(), leaking the fd reference (and the underlying fd itself,
once/if it was the last reference) every time wcmDevStart() fails on
an otherwise successfully-opened device.

Call wcmDevClose() on that failure path, mirroring what DEVICE_OFF
already does, guarded by the same XI86_SERVER_FD check wcmDevOpen()
itself was guarded by.

Signed-off-by: Enrico Weigelt, metux IT consult info@metux.net

The DEVICE_ON case calls wcmDevOpen() (which takes an fd reference,
incrementing common->fd_refs) and then wcmDevStart(); on
wcmDevStart() failure it jumped straight to 'out' without undoing the
wcmDevOpen(), leaking the fd reference (and the underlying fd itself,
once/if it was the last reference) every time wcmDevStart() fails on
an otherwise successfully-opened device.

Call wcmDevClose() on that failure path, mirroring what DEVICE_OFF
already does, guarded by the same XI86_SERVER_FD check wcmDevOpen()
itself was guarded by.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant