pstore: Avoid race in module unloading
authorKees Cook <keescook@chromium.org>
Sat, 4 Mar 2017 01:45:38 +0000 (17:45 -0800)
committerKees Cook <keescook@chromium.org>
Tue, 7 Mar 2017 16:21:38 +0000 (08:21 -0800)
Technically, it might be possible for struct pstore_info to go out of
scope after the module_put(), so report the backend name first.

Signed-off-by: Kees Cook <keescook@chromium.org>
fs/pstore/platform.c

index 074fe85a207806b745d2748c1ea431e0da96a5cb..d69ef8a840b96152568073034b3c7d73377f2261 100644 (file)
@@ -722,10 +722,10 @@ int pstore_register(struct pstore_info *psi)
         */
        backend = psi->name;
 
-       module_put(owner);
-
        pr_info("Registered %s as persistent store backend\n", psi->name);
 
+       module_put(owner);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(pstore_register);