Skip to content

Commit

Permalink
PM / Hibernate: Disable usermode helpers right before freezing tasks
Browse files Browse the repository at this point in the history
There is no reason to call usermodehelper_disable() before creating
memory bitmaps in hibernate() and software_resume(), so call it right
before freeze_processes(), in accordance with the other suspend and
hibernation code.  Consequently, call usermodehelper_enable() right
after the thawing of tasks rather than after freeing the memory
bitmaps.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: stable@vger.kernel.org
  • Loading branch information
Rafael J. Wysocki committed Mar 28, 2012
1 parent 9b78c1d commit 7b5179a
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions kernel/power/hibernate.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,19 +611,19 @@ int hibernate(void)
if (error)
goto Exit;

error = usermodehelper_disable();
if (error)
goto Exit;

/* Allocate memory management structures */
error = create_basic_memory_bitmaps();
if (error)
goto Enable_umh;
goto Exit;

printk(KERN_INFO "PM: Syncing filesystems ... ");
sys_sync();
printk("done.\n");

error = usermodehelper_disable();
if (error)
goto Exit;

error = freeze_processes();
if (error)
goto Free_bitmaps;
Expand Down Expand Up @@ -660,9 +660,8 @@ int hibernate(void)
freezer_test_done = false;

Free_bitmaps:
free_basic_memory_bitmaps();
Enable_umh:
usermodehelper_enable();
free_basic_memory_bitmaps();
Exit:
pm_notifier_call_chain(PM_POST_HIBERNATION);
pm_restore_console();
Expand Down Expand Up @@ -777,15 +776,13 @@ static int software_resume(void)
if (error)
goto close_finish;

error = usermodehelper_disable();
error = create_basic_memory_bitmaps();
if (error)
goto close_finish;

error = create_basic_memory_bitmaps();
if (error) {
usermodehelper_enable();
error = usermodehelper_disable();
if (error)
goto close_finish;
}

pr_debug("PM: Preparing processes for restore.\n");
error = freeze_processes();
Expand All @@ -805,8 +802,8 @@ static int software_resume(void)
swsusp_free();
thaw_processes();
Done:
free_basic_memory_bitmaps();
usermodehelper_enable();
free_basic_memory_bitmaps();
Finish:
pm_notifier_call_chain(PM_POST_RESTORE);
pm_restore_console();
Expand Down

0 comments on commit 7b5179a

Please sign in to comment.