hardware/intel/common/libva
Revision | b7203fe3b1fa633cece9cd9e5715b6477a708455 (tree) |
---|---|
Time | 2018-12-03 14:43:38 |
Author | Mark Thompson <sw@jkqx...> |
Commiter | XinfengZhang |
Remove restrictions on vaSetDriverName()
The UID restriction has no effect, since any code capable of calling
vaSetDriverName() can also edit the internals of the structure itself.
(This check was inherited from the environment variable setting, where
it does do something.)
The name whitelist prevents loading drivers not currently named on the
list, such as the Mesa and V4L2-request drivers. I don't believe there
is any reason to prevent loading another driver, and it is already
possible via the LIBVA_DRIVER_NAME environment variable.
Signed-off-by: Mark Thompson <sw@jkqxz.net>
@@ -605,13 +605,6 @@ const char *vaErrorStr(VAStatus error_status) | ||
605 | 605 | return "unknown libva error / description missing"; |
606 | 606 | } |
607 | 607 | |
608 | -const static char *prefer_driver_list[4] = { | |
609 | - "i965", | |
610 | - "hybrid", | |
611 | - "pvr", | |
612 | - "iHD", | |
613 | -}; | |
614 | - | |
615 | 608 | VAStatus vaSetDriverName( |
616 | 609 | VADisplay dpy, |
617 | 610 | char *driver_name |
@@ -620,15 +613,8 @@ VAStatus vaSetDriverName( | ||
620 | 613 | VADriverContextP ctx; |
621 | 614 | VAStatus vaStatus = VA_STATUS_SUCCESS; |
622 | 615 | char *override_driver_name = NULL; |
623 | - int i, found; | |
624 | 616 | ctx = CTX(dpy); |
625 | 617 | |
626 | - if (geteuid() != getuid()) { | |
627 | - vaStatus = VA_STATUS_ERROR_OPERATION_FAILED; | |
628 | - va_errorMessage(dpy, "no permission to vaSetDriverName\n"); | |
629 | - return vaStatus; | |
630 | - } | |
631 | - | |
632 | 618 | if (strlen(driver_name) == 0 || strlen(driver_name) >=256) { |
633 | 619 | vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER; |
634 | 620 | va_errorMessage(dpy, "vaSetDriverName returns %s\n", |
@@ -636,25 +622,7 @@ VAStatus vaSetDriverName( | ||
636 | 622 | return vaStatus; |
637 | 623 | } |
638 | 624 | |
639 | - found = 0; | |
640 | - for (i = 0; i < sizeof(prefer_driver_list) / sizeof(char *); i++) { | |
641 | - if (strlen(prefer_driver_list[i]) != strlen(driver_name)) | |
642 | - continue; | |
643 | - if (!strncmp(prefer_driver_list[i], driver_name, strlen(driver_name))) { | |
644 | - found = 1; | |
645 | - break; | |
646 | - } | |
647 | - } | |
648 | - | |
649 | - if (!found) { | |
650 | - vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER; | |
651 | - va_errorMessage(dpy, "vaSetDriverName returns %s. Incorrect parameter\n", | |
652 | - vaErrorStr(vaStatus)); | |
653 | - return vaStatus; | |
654 | - } | |
655 | - | |
656 | 625 | override_driver_name = strdup(driver_name); |
657 | - | |
658 | 626 | if (!override_driver_name) { |
659 | 627 | vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED; |
660 | 628 | va_errorMessage(dpy, "vaSetDriverName returns %s. Out of Memory\n", |