From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kees Cook Subject: [PATCH 03/18] pstore: Avoid race in module unloading Date: Mon, 6 Mar 2017 13:55:17 -0800 Message-ID: <1488837332-71582-4-git-send-email-keescook@chromium.org> References: <1488837332-71582-1-git-send-email-keescook@chromium.org> Return-path: In-Reply-To: <1488837332-71582-1-git-send-email-keescook@chromium.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" To: linux-kernel@vger.kernel.org Cc: linux-efi@vger.kernel.org, linux-doc@vger.kernel.org, Matt Fleming , Pan Xinhui , Paul Gortmaker , Paul Mackerras , Anton Vorontsov , linux-acpi@vger.kernel.org, Nathan Fontenot , Len Brown , Kees Cook , Nobuhiro Iwamatsu , Geliang Tang , Tony Luck , Daniel Axtens , Qiuxu Zhuo , Ard Biesheuvel , "Rafael J. Wysocki" , Colin Cross , linuxppc-dev@lists.ozlabs.org List-Id: linux-acpi@vger.kernel.org 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 --- fs/pstore/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 074fe85a2078..d69ef8a840b9 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -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); -- 2.7.4