[PATCH] swsusp: prevent possible image corruption on resume
authorRafael J. Wysocki <rjw@sisk.pl>
Wed, 19 Apr 2006 05:20:29 +0000 (22:20 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 19 Apr 2006 16:13:49 +0000 (09:13 -0700)
commit4a3b98a422a20dedf3a2a40c44892d6e7e665157
tree24387ffda32d2d7a8582116cd39654bf1fac19fe
parent8db08de4f6ae24e90aedf5125b5ddd52ffff15f4
[PATCH] swsusp: prevent possible image corruption on resume

The function free_pagedir() used by swsusp for freeing its internal data
structures clears the PG_nosave and PG_nosave_free flags for each page
being freed.

However, during resume PG_nosave_free set means that the page in
question is "unsafe" (ie.  it will be overwritten in the process of
restoring the saved system state from the image), so it should not be
used for the image data.

Therefore free_pagedir() should not clear PG_nosave_free if it's called
during resume (otherwise "unsafe" pages freed by it may be used for
storing the image data and the data may get corrupted later on).

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/power/snapshot.c