Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932505AbdCFWZP (ORCPT ); Mon, 6 Mar 2017 17:25:15 -0500 Received: from mail-pf0-f176.google.com ([209.85.192.176]:36088 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932440AbdCFWZN (ORCPT ); Mon, 6 Mar 2017 17:25:13 -0500 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , Nobuhiro Iwamatsu , Qiuxu Zhuo , Ard Biesheuvel , Anton Vorontsov , Colin Cross , Tony Luck , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "Rafael J. Wysocki" , Len Brown , Matt Fleming , Nathan Fontenot , Pan Xinhui , Daniel Axtens , Paul Gortmaker , Geliang Tang , linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, linux-efi@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH 04/18] pstore: Improve register_pstore() error reporting Date: Mon, 6 Mar 2017 13:55:18 -0800 Message-Id: <1488837332-71582-5-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488837332-71582-1-git-send-email-keescook@chromium.org> References: <1488837332-71582-1-git-send-email-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 921 Lines: 32 Uncommon errors are better to get reported to dmesg so developers can more easily figure out why pstore is unhappy with a backend attempting to register. Signed-off-by: Kees Cook --- fs/pstore/platform.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index d69ef8a840b9..320a673ecb5b 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -673,11 +673,15 @@ int pstore_register(struct pstore_info *psi) { struct module *owner = psi->owner; - if (backend && strcmp(backend, psi->name)) + if (backend && strcmp(backend, psi->name)) { + pr_warn("ignoring unexpected backend '%s'\n", psi->name); return -EPERM; + } spin_lock(&pstore_lock); if (psinfo) { + pr_warn("backend '%s' already loaded: ignoring '%s'\n", + psinfo->name, psi->name); spin_unlock(&pstore_lock); return -EBUSY; } -- 2.7.4