Commit d85644dc authored by Guilherme G. Piccoli's avatar Guilherme G. Piccoli Committed by Kees Cook

pstore: Improve error reporting in case of backend overlap

The pstore infrastructure supports one single backend at a time;
trying to load a another backend causes an error and displays a
message, introduced on commit 0d7cd09a ("pstore: Improve
register_pstore() error reporting").

Happens that this message is not really clear about the situation,
also the current error returned (-EPERM) isn't accurate, whereas
-EBUSY makes more sense. We have another place in the code that
relies in the -EBUSY return for a similar check.

So, make it consistent here by returning -EBUSY and using a
similar message in both scenarios.
Signed-off-by: default avatarGuilherme G. Piccoli <gpiccoli@igalia.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20221006224212.569555-2-gpiccoli@igalia.com
parent 99b3b837
...@@ -562,8 +562,9 @@ static int pstore_write_user_compat(struct pstore_record *record, ...@@ -562,8 +562,9 @@ static int pstore_write_user_compat(struct pstore_record *record,
int pstore_register(struct pstore_info *psi) int pstore_register(struct pstore_info *psi)
{ {
if (backend && strcmp(backend, psi->name)) { if (backend && strcmp(backend, psi->name)) {
pr_warn("ignoring unexpected backend '%s'\n", psi->name); pr_warn("backend '%s' already in use: ignoring '%s'\n",
return -EPERM; backend, psi->name);
return -EBUSY;
} }
/* Sanity check flags. */ /* Sanity check flags. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment