-
Notifications
You must be signed in to change notification settings - Fork 10
[FIPS 9.2 Compliant] CVE-2024-58002 #603
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
[FIPS 9.2 Compliant] CVE-2024-58002 #603
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses CVE-2024-58002 by implementing a comprehensive fix for dangling pointer issues in the UVC video driver. The changes introduce proper reference counting and cleanup mechanisms for asynchronous control handles to prevent use-after-free vulnerabilities.
Key changes:
- Added reference counting for pending asynchronous controls per file handle
- Implemented proper cleanup of dangling pointers when file handles are released
- Refactored control handle management with thread-safe operations
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| drivers/media/usb/uvc/uvcvideo.h | Added pending_async_ctrls field and uvc_ctrl_cleanup_fh declaration |
| drivers/media/usb/uvc/uvc_v4l2.c | Added cleanup call in file release handler |
| drivers/media/usb/uvc/uvc_ctrl.c | Implemented reference counting and cleanup logic for control handles |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
a6c2456 to
7775b45
Compare
|
I would say this was a test to catch Co-Pilot and reviewers but in reality it was me moving too fast with too many spinning plates. |
bmastbergen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥌
c48b137 to
98202de
Compare
jira VULN-53466 cve-pre CVE-2024-58002 commit-author Ricardo Ribalda <[email protected]> commit 64627da Avoid using the iterators after the list_for_each() constructs. This patch should be a NOP, but makes cocci, happier: drivers/media/usb/uvc/uvc_ctrl.c:1861:44-50: ERROR: invalid reference to the index variable of the iterator on line 1850 drivers/media/usb/uvc/uvc_ctrl.c:2195:17-23: ERROR: invalid reference to the index variable of the iterator on line 2179 Reviewed-by: Sergey Senozhatsky <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Ricardo Ribalda <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> (cherry picked from commit 64627da) Signed-off-by: Jonathan Maple <[email protected]>
jira VULN-53466 cve-pre CVE-2024-58002 commit-author Ricardo Ribalda <[email protected]> commit d9fecd0 Now we keep a reference to the active fh for any call to uvc_ctrl_set, regardless if it is an actual set or if it is a just a try or if the device refused the operation. We should only keep the file handle if the device actually accepted applying the operation. Cc: [email protected] Fixes: e5225c8 ("media: uvcvideo: Send a control event when a Control Change interrupt arrives") Suggested-by: Hans de Goede <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Ricardo Ribalda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> (cherry picked from commit d9fecd0) Signed-off-by: Jonathan Maple <[email protected]>
98202de to
aeb4a52
Compare
|
Updated KbuildKselfTests |
kerneltoast
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, just two nits on the upstream-diff blurb in media: uvcvideo: Remove dangling pointers:
upstream-diff used kernel-lt 5.15 commit 117f7a2
This is due to missing both:
- 54da6a0 - locking: Introduce __cleanup() based infrastructure
-
Those shortened commit hashes are too short to identify a single specific commit, use e.g.
git rev-parse --short SHAto get the shortest unique hash. -
"This is due to missing both:" but only one thing is listed.
jira VULN-53466 cve CVE-2024-58002 commit-author Ricardo Ribalda <[email protected]> commit 221cd51 upstream-diff used kernel-lt 5.15 commit 117f7a2 This is due to missing: - 54da6a0 - locking: Introduce __cleanup() based infrastructure When an async control is written, we copy a pointer to the file handle that started the operation. That pointer will be used when the device is done. Which could be anytime in the future. If the user closes that file descriptor, its structure will be freed, and there will be one dangling pointer per pending async control, that the driver will try to use. Clean all the dangling pointers during release(). To avoid adding a performance penalty in the most common case (no async operation), a counter has been introduced with some logic to make sure that it is properly handled. Cc: [email protected] Fixes: e5225c8 ("media: uvcvideo: Send a control event when a Control Change interrupt arrives") Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> (cherry picked from commit 221cd51) Signed-off-by: Jonathan Maple <[email protected]>
aeb4a52 to
b0a8286
Compare
kerneltoast
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
BUILD
KselfTest
KselfTest Diff Experimental