Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling issues in vinput.c #277

Closed
NOVBobLee opened this issue Oct 23, 2024 · 1 comment
Closed

Error handling issues in vinput.c #277

NOVBobLee opened this issue Oct 23, 2024 · 1 comment

Comments

@NOVBobLee
Copy link
Collaborator

NOVBobLee commented Oct 23, 2024

Two issues about error handling in export_store function.

  1. When vinput_register_vdevice fails, the current error handling process calls device_unregister followed by vinput_destroy_vdevice. However, device_unregister triggers its release function, which already includes a call to vinput_destroy_vdevice. As a result, vinput_destroy_vdevice is called twice. Since vinput_destroy_vdevice contains module_put, this double call must be avoided to prevent potential reference count issues.

  2. The error handling paths following a successful vinput_alloc_vdevice call are missing a corresponding input_free_device call. Since vinput_alloc_vdevice internally calls input_allocate_device, and input_register_device has not been called yet, input_free_device should be used to properly free the allocated input_device struct in this scenario [1].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/input/input.c#n2094

I think I can make the patch tomorrow.

@NOVBobLee
Copy link
Collaborator Author

Fixed #278, fixed #279

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

No branches or pull requests

1 participant