summaryrefslogtreecommitdiff
path: root/va
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-11-13 23:56:13 +0000
committerXinfengZhang <carl.zhang@intel.com>2018-12-03 13:43:38 +0800
commitb7203fe3b1fa633cece9cd9e5715b6477a708455 (patch)
tree7c1ac4965dc88e5db9d3997ea2ce5453863a6a5f /va
parent285267586a3d4db0e721d30d4a5f5f9fe6a3c913 (diff)
downloadlibva-b7203fe3b1fa633cece9cd9e5715b6477a708455.tar.gz
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>
Diffstat (limited to 'va')
-rw-r--r--va/va.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/va/va.c b/va/va.c
index 774129c..7801508 100644
--- a/va/va.c
+++ b/va/va.c
@@ -605,13 +605,6 @@ const char *vaErrorStr(VAStatus error_status)
return "unknown libva error / description missing";
}
-const static char *prefer_driver_list[4] = {
- "i965",
- "hybrid",
- "pvr",
- "iHD",
-};
-
VAStatus vaSetDriverName(
VADisplay dpy,
char *driver_name
@@ -620,15 +613,8 @@ VAStatus vaSetDriverName(
VADriverContextP ctx;
VAStatus vaStatus = VA_STATUS_SUCCESS;
char *override_driver_name = NULL;
- int i, found;
ctx = CTX(dpy);
- if (geteuid() != getuid()) {
- vaStatus = VA_STATUS_ERROR_OPERATION_FAILED;
- va_errorMessage(dpy, "no permission to vaSetDriverName\n");
- return vaStatus;
- }
-
if (strlen(driver_name) == 0 || strlen(driver_name) >=256) {
vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
va_errorMessage(dpy, "vaSetDriverName returns %s\n",
@@ -636,25 +622,7 @@ VAStatus vaSetDriverName(
return vaStatus;
}
- found = 0;
- for (i = 0; i < sizeof(prefer_driver_list) / sizeof(char *); i++) {
- if (strlen(prefer_driver_list[i]) != strlen(driver_name))
- continue;
- if (!strncmp(prefer_driver_list[i], driver_name, strlen(driver_name))) {
- found = 1;
- break;
- }
- }
-
- if (!found) {
- vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
- va_errorMessage(dpy, "vaSetDriverName returns %s. Incorrect parameter\n",
- vaErrorStr(vaStatus));
- return vaStatus;
- }
-
override_driver_name = strdup(driver_name);
-
if (!override_driver_name) {
vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
va_errorMessage(dpy, "vaSetDriverName returns %s. Out of Memory\n",