Skip to content

Commit

Permalink
[S390] xpram: Remove checksum validation for suspend/resume
Browse files Browse the repository at this point in the history
Currently in the suspend process checksums for the XPRAM partitions are
created and stored. During the resume process it is checked,
if the checksums are still the same. If this is not the case, a kernel panic
is triggered. Unfortunately this prevents XPRAM from beeing used as suspend
device, because in this case after the checksum has been created, the
memory image is written to XPRAM and therefore the contents of the suspend
partition is changed. In order to allow XPRAM to be used as suspend device,
this patch removes the checksum validation.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Michael Holzheu authored and Martin Schwidefsky committed Sep 11, 2009
1 parent 3f7cb51 commit 99b5e2d
Showing 1 changed file with 0 additions and 65 deletions.
65 changes: 0 additions & 65 deletions drivers/s390/block/xpram.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include <linux/suspend.h>
#include <linux/platform_device.h>
#include <asm/uaccess.h>
#include <asm/checksum.h>

#define XPRAM_NAME "xpram"
#define XPRAM_DEVS 1 /* one partition */
Expand All @@ -51,7 +50,6 @@
typedef struct {
unsigned int size; /* size of xpram segment in pages */
unsigned int offset; /* start page of xpram segment */
unsigned int csum; /* partition checksum for suspend */
} xpram_device_t;

static xpram_device_t xpram_devices[XPRAM_MAX_DEVS];
Expand Down Expand Up @@ -386,58 +384,6 @@ static int __init xpram_setup_blkdev(void)
return rc;
}

/*
* Save checksums for all partitions.
*/
static int xpram_save_checksums(void)
{
unsigned long mem_page;
int rc, i;

rc = 0;
mem_page = (unsigned long) __get_free_page(GFP_KERNEL);
if (!mem_page)
return -ENOMEM;
for (i = 0; i < xpram_devs; i++) {
rc = xpram_page_in(mem_page, xpram_devices[i].offset);
if (rc)
goto fail;
xpram_devices[i].csum = csum_partial((const void *) mem_page,
PAGE_SIZE, 0);
}
fail:
free_page(mem_page);
return rc ? -ENXIO : 0;
}

/*
* Verify checksums for all partitions.
*/
static int xpram_validate_checksums(void)
{
unsigned long mem_page;
unsigned int csum;
int rc, i;

rc = 0;
mem_page = (unsigned long) __get_free_page(GFP_KERNEL);
if (!mem_page)
return -ENOMEM;
for (i = 0; i < xpram_devs; i++) {
rc = xpram_page_in(mem_page, xpram_devices[i].offset);
if (rc)
goto fail;
csum = csum_partial((const void *) mem_page, PAGE_SIZE, 0);
if (xpram_devices[i].csum != csum) {
rc = -EINVAL;
goto fail;
}
}
fail:
free_page(mem_page);
return rc ? -ENXIO : 0;
}

/*
* Resume failed: Print error message and call panic.
*/
Expand All @@ -458,21 +404,10 @@ static int xpram_restore(struct device *dev)
xpram_resume_error("xpram disappeared");
if (xpram_pages != xpram_highest_page_index() + 1)
xpram_resume_error("Size of xpram changed");
if (xpram_validate_checksums())
xpram_resume_error("Data of xpram changed");
return 0;
}

/*
* Save necessary state in suspend.
*/
static int xpram_freeze(struct device *dev)
{
return xpram_save_checksums();
}

static struct dev_pm_ops xpram_pm_ops = {
.freeze = xpram_freeze,
.restore = xpram_restore,
};

Expand Down

0 comments on commit 99b5e2d

Please sign in to comment.