Commit 7775b45
committed
media: uvcvideo: Remove dangling pointers
jira VULN-53466
cve CVE-2024-58002
commit-author Ricardo Ribalda <ribalda@chromium.org>
commit 221cd51
upstream-diff We are missing 54da6a0 - "locking: Introduce __cleanup()
based infrastructure" which is part of an extremely large
changeset. Integrating this is not viable, so we're going to
use the same update as the KERNEL_ORG-LT 5.15 backport:
117f7a2. This replaces the guard with a standard
mutex_lock().
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: stable@vger.kernel.org
Fixes: e5225c8 ("media: uvcvideo: Send a control event when a Control Change interrupt arrives")
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20241203-uvc-fix-async-v6-3-26c867231118@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
(cherry picked from commit 221cd51)
Signed-off-by: Jonathan Maple <jmaple@ciq.com>1 parent 11ce137 commit 7775b45
3 files changed
+70
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1378 | 1378 | | |
1379 | 1379 | | |
1380 | 1380 | | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
1381 | 1415 | | |
1382 | 1416 | | |
1383 | 1417 | | |
| |||
1388 | 1422 | | |
1389 | 1423 | | |
1390 | 1424 | | |
1391 | | - | |
| 1425 | + | |
| 1426 | + | |
1392 | 1427 | | |
1393 | 1428 | | |
1394 | 1429 | | |
| |||
1660 | 1695 | | |
1661 | 1696 | | |
1662 | 1697 | | |
1663 | | - | |
| 1698 | + | |
1664 | 1699 | | |
1665 | 1700 | | |
1666 | 1701 | | |
| |||
2573 | 2608 | | |
2574 | 2609 | | |
2575 | 2610 | | |
| 2611 | + | |
| 2612 | + | |
| 2613 | + | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
| 2630 | + | |
| 2631 | + | |
| 2632 | + | |
| 2633 | + | |
2576 | 2634 | | |
2577 | 2635 | | |
2578 | 2636 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
| 609 | + | |
| 610 | + | |
609 | 611 | | |
610 | 612 | | |
611 | 613 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
479 | 483 | | |
480 | 484 | | |
481 | 485 | | |
| |||
728 | 732 | | |
729 | 733 | | |
730 | 734 | | |
| 735 | + | |
731 | 736 | | |
732 | 737 | | |
733 | 738 | | |
| |||
910 | 915 | | |
911 | 916 | | |
912 | 917 | | |
| 918 | + | |
| 919 | + | |
913 | 920 | | |
914 | 921 | | |
915 | 922 | | |
| |||
0 commit comments