Skip to content

Commit

Permalink
pstore: Drop useless try_module_get() for backend
Browse files Browse the repository at this point in the history
There is no reason to be doing a module get/put in pstore_register(),
since the module calling pstore_register() cannot be unloaded since it
hasn't finished its initialization. Remove it so there is no confusion
about how registration ordering works.

Link: https://lore.kernel.org/lkml/[email protected]/
Signed-off-by: Kees Cook <[email protected]>
  • Loading branch information
kees committed May 12, 2020
1 parent 8f3d9f3 commit e7c1c00
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions fs/pstore/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,6 @@ static int pstore_write_user_compat(struct pstore_record *record,
*/
int pstore_register(struct pstore_info *psi)
{
struct module *owner = psi->owner;

if (backend && strcmp(backend, psi->name)) {
pr_warn("ignoring unexpected backend '%s'\n", psi->name);
return -EPERM;
Expand Down Expand Up @@ -591,10 +589,6 @@ int pstore_register(struct pstore_info *psi)
sema_init(&psinfo->buf_lock, 1);
spin_unlock(&pstore_lock);

if (owner && !try_module_get(owner)) {
psinfo = NULL;
return -EINVAL;
}

if (psi->flags & PSTORE_FLAGS_DMESG)
allocate_buf_for_compression();
Expand Down Expand Up @@ -626,8 +620,6 @@ int pstore_register(struct pstore_info *psi)

pr_info("Registered %s as persistent store backend\n", psi->name);

module_put(owner);

return 0;
}
EXPORT_SYMBOL_GPL(pstore_register);
Expand Down

0 comments on commit e7c1c00

Please sign in to comment.