[PATCH] Don't explode on swsusp failure to find swap

From: Benjamin Herrenschmidt (benh_at_kernel.crashing.org)
Date: 05/31/05

  • Next message: Eran Mann: "Re: [patch] Real-Time Preemption, -RT-2.6.12-rc5-V0.7.47-10"
    To: Linux-pm mailing list <linux-pm@lists.osdl.org>
    Date:	Tue, 31 May 2005 17:13:05 +1000
    
    

    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 <benh@kernel.crashing.org>

    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;
     }
     
     

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Eran Mann: "Re: [patch] Real-Time Preemption, -RT-2.6.12-rc5-V0.7.47-10"

    Relevant Pages

    • Re: [RFC] userland swsusp
      ... filesystem code from grub. ... userspace could write the image to swap as the kernel ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Suspend/resume to disk problem
      ... I'm using Debian GNU/linux 3.1 with kernel 2.6.10 on my IBM Thinkpad ... and I'm experiencing a strange problem with suspend to disk. ... swsusp: FATAL: cannot find swap device, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH 2.6.12-rc4] Add EXPORT_SYMBOL for hotplug_path
      ... no one should be calling ... >> hotplug on their own, lots of bad things happen to udevd and HAL if they ... > The change never made it into the kernel. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH 2.6.12-rc4] Add EXPORT_SYMBOL for hotplug_path
      ... no one should be calling ... > hotplug on their own, lots of bad things happen to udevd and HAL if they ... The change never made it into the kernel. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • RE: Cache queue_congestion_on/off_threshold
      ... >> severly into the noise area when submitting io. ... There isn't anything absurd in 2.6 kernel, however, I hate to say that we ... it's better to check queue empty before calling into q->request_fn ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)