From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Subject: [PATCH] Don't explode on swsusp failure to find swap Date: Tue, 31 May 2005 17:13:05 +1000 Message-ID: <1117523585.5826.18.camel@gaston> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============78163512628139253==" Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.osdl.org Errors-To: linux-pm-bounces@lists.osdl.org To: Linux-pm mailing list Cc: Linux Kernel list , Pavel Machek List-Id: linux-pm@vger.kernel.org --===============78163512628139253== Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi ! If we specify a swap device for swsusp using resume= kernel argument and that device doesn't exist in the swap list, we end up calling swsusp_free() before we have allocated pagedir_save. That causes us to explode when trying to free it. Pavel, does that look right ? Signed-off-by: Benjamin Herrenschmidt Index: linux-work/kernel/power/swsusp.c =================================================================== --- linux-work.orig/kernel/power/swsusp.c 2005-05-31 16:29:22.000000000 +1000 +++ linux-work/kernel/power/swsusp.c 2005-05-31 16:57:30.000000000 +1000 @@ -730,10 +730,13 @@ void swsusp_free(void) { + if (pagedir_save == NULL) + return; BUG_ON(PageNosave(virt_to_page(pagedir_save))); BUG_ON(PageNosaveFree(virt_to_page(pagedir_save))); free_image_pages(); free_pagedir(pagedir_save); + pagedir_save = NULL; } --===============78163512628139253== Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline --===============78163512628139253==--