xserver: Branch 'master'

Peter Hutterer whot at kemper.freedesktop.org
Wed Feb 1 01:46:03 UTC 2017


 hw/xfree86/loader/loadmod.c |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 45e0eb4b156f2155687cce268b07f10540fc507b
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Jan 26 16:24:03 2017 +0900

    loader: Handle mod->VersionInfo == NULL
    
    This can happen when a module fails to load:
    
    Program received signal SIGSEGV, Segmentation fault.
    UnloadModule (_mod=0x5555559d9280) at ../../../../hw/xfree86/loader/loadmod.c:848
    848	    name = mod->VersionInfo->modname;
    (gdb) bt
    #0  UnloadModule (_mod=0x5555559d9280) at ../../../../hw/xfree86/loader/loadmod.c:848
    #1  0x00005555555ddd1b in LoadModule (module=module at entry=0x5555559c7ce0 "fbdev", options=0x0, modreq=modreq at entry=0x0, errmaj=errmaj at entry=0x7fffffffe8ec) at ../../../../hw/xfree86/loader/loadmod.c:824
    #2  0x00005555555edfe9 in xf86LoadModules (list=list at entry=0x5555559dcf50, optlist=optlist at entry=0x0) at ../../../../hw/xfree86/common/xf86Init.c:1506
    #3  0x00005555555ee7bc in InitOutput (pScreenInfo=pScreenInfo at entry=0x5555559abf80 <screenInfo>, argc=argc at entry=4, argv=argv at entry=0x7fffffffeb18) at ../../../../hw/xfree86/common/xf86Init.c:484
    #4  0x00005555555a885c in dix_main (argc=4, argv=0x7fffffffeb18, envp=<optimized out>) at ../../dix/main.c:197
    #5  0x00007ffff5d582b1 in __libc_start_main (main=0x555555593130 <main>, argc=4, argv=0x7fffffffeb18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffeb08) at ../csu/libc-start.c:291
    #6  0x000055555559316a in _start ()
    
    Fixes: 8e83eacb9e2d ("loader: Remove unused path and name from ModuleDescPtr")
    Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index ca77c7a..09aae0e 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -837,7 +837,6 @@ void
 UnloadModule(void *_mod)
 {
     ModuleDescPtr mod = _mod;
-    const char *name;
 
     if (mod == (ModuleDescPtr) 1)
         return;
@@ -845,17 +844,19 @@ UnloadModule(void *_mod)
     if (mod == NULL)
         return;
 
-    name = mod->VersionInfo->modname;
+    if (mod->VersionInfo) {
+        const char *name = mod->VersionInfo->modname;
 
-    if (mod->parent)
-        LogMessageVerbSigSafe(X_INFO, 3, "UnloadSubModule: \"%s\"\n", name);
-    else
-        LogMessageVerbSigSafe(X_INFO, 3, "UnloadModule: \"%s\"\n", name);
+        if (mod->parent)
+            LogMessageVerbSigSafe(X_INFO, 3, "UnloadSubModule: \"%s\"\n", name);
+        else
+            LogMessageVerbSigSafe(X_INFO, 3, "UnloadModule: \"%s\"\n", name);
 
-    if (mod->TearDownData != ModuleDuplicated) {
-        if ((mod->TearDownProc) && (mod->TearDownData))
-            mod->TearDownProc(mod->TearDownData);
-        LoaderUnload(name, mod->handle);
+        if (mod->TearDownData != ModuleDuplicated) {
+            if ((mod->TearDownProc) && (mod->TearDownData))
+                mod->TearDownProc(mod->TearDownData);
+            LoaderUnload(name, mod->handle);
+        }
     }
 
     if (mod->child)


More information about the xorg-commit mailing list