From: James Jones Date: Fri, 9 Jul 2021 15:40:19 +0000 (-0700) Subject: loader: Handle failure to load DRI driver library X-Git-Tag: upstream/21.2.3~474 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2252de03e655aecff0f10573f8c541470775128;p=platform%2Fupstream%2Fmesa.git loader: Handle failure to load DRI driver library I factored out the chunk of loader code that dlopen()s libraries from the rest of the DRI driver loader function in this commit: commit bc343154f816b637b200933e1c1a35db19f478ef Author: James Jones Date: Thu Apr 22 23:17:08 2021 -0700 loader: Factor out driver library loading code However, I failed to adjust the DRI loader function that now uses the new helper function to handle the case where the requested DRI library is not found. This change restores the prior behavior, and also ensures loader_open_driver() consistently returns NULL in the out_driver_handle parameter on failure. Fixes: bc343154f816 ("loader: Factor out driver library loading code") Signed-off-by: James Jones Reviewed-by: Adam Jackson Part-of: --- diff --git a/src/loader/loader.c b/src/loader/loader.c index b4a3ca7..08eeb61 100644 --- a/src/loader/loader.c +++ b/src/loader/loader.c @@ -612,6 +612,9 @@ loader_open_driver(const char *driver_name, void *driver = loader_open_driver_lib(driver_name, "_dri", search_path_vars, DEFAULT_DRIVER_DIR, true); + if (!driver) + goto failed; + get_extensions_name = loader_get_extensions_name(driver_name); if (get_extensions_name) { get_extensions = dlsym(driver, get_extensions_name); @@ -630,8 +633,10 @@ loader_open_driver(const char *driver_name, log_(_LOADER_WARNING, "MESA-LOADER: driver exports no extensions (%s)\n", dlerror()); dlclose(driver); + driver = NULL; } +failed: *out_driver_handle = driver; return extensions; }