Re: [linux-pm] Re: [PATCH] Don't explode on swsusp failure to find swap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wednesday, 1 of June 2005 11:27, Pavel Machek wrote:
> 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 ?
> > > > 
> > > > It looks like a workaround. We should not call swsusp_free in case
> > > > device does not exists. Quick look did not reveal where the bug comes
> > > > from, can you try to trace it?
> > > > 								Pavel
> > > 
> > > Well, the bug comes from arch code calling swsusp_save() which fails,
> > > then we call swsusp_free()
> > 
> > More specifically, arch suspend calls swsusp_save().
> > 
> > It fails and returns the error to the arch asm code, which itself
> > returns it to it's caller swsusp_suspend(), which does that:
> > 
> >  	if ((error = swsusp_arch_suspend()))
> > 		swsusp_free();
> 
> Ugh, swsusp_free should be totally unneccessary at this point; only
> error returns are from the time before anything is allocated.

Oops, it looks like I have introduced these swsusp_free()s, so I'm sorry ...

> Does something like this help?
> 
> diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
> --- a/kernel/power/swsusp.c
> +++ b/kernel/power/swsusp.c
> @@ -975,13 +975,6 @@ extern asmlinkage int swsusp_arch_resume
>  
>  asmlinkage int swsusp_save(void)
>  {
> -	int error = 0;
> -
> -	if ((error = swsusp_swap_check())) {
> -		printk(KERN_ERR "swsusp: FATAL: cannot find swap device, try "
> -				"swapon -a!\n");
> -		return error;
> -	}
>  	return suspend_prepare_image();
>  }

I think we can move the contents of suspend_prepare_image() directly to
swsusp_save().  It's not used anywhere else.

Greets,
Rafael


-- 
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
		-- Lewis Carroll "Alice's Adventures in Wonderland"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux