panic handle: check partition boundary when log is written
authorZhang Dongxing <dongxing.zhang@intel.com>
Wed, 11 Apr 2012 05:29:26 +0000 (13:29 +0800)
committerbuildbot <buildbot@intel.com>
Tue, 17 Apr 2012 13:20:51 +0000 (06:20 -0700)
BZ: 31254

Change-Id: I9736b1c8b6bca677058ebca1dcdab11773dfc79a
Signed-off-by: Zhang Dongxing <dongxing.zhang@intel.com>
Reviewed-on: http://android.intel.com:8080/43030
Reviewed-by: Guerard, Christophe <christophe.guerard@intel.com>
Reviewed-by: Zhang, Jun <jun.zhang@intel.com>
Reviewed-by: Kanigeri, Hari K <hari.k.kanigeri@intel.com>
Tested-by: Guerard, Christophe <christophe.guerard@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/misc/emmc_ipanic.c

index 69a5c0b..cdbebc0 100755 (executable)
@@ -477,6 +477,11 @@ static int emmc_ipanic_writeflashpage(struct mmc_emergency_info *emmc,
        int rc;
        size_t wlen = SECTOR_SIZE;
 
+       if (to >= emmc->start_block + emmc->block_count) {
+               printk(KERN_EMERG "%s: panic partition is full.\n", __func__);
+               return 0;
+       }
+
        rc = emmc->write((char *)buf, (unsigned int)to);
        if (rc) {
                printk(KERN_EMERG