[PATCHv2 11/18] DSPBRIDGE: Do not panic on bad page count

Omar Ramirez Luna
2009-12-17T02:08:49Z

If a page doesn't have a sane count, do not panic or release it.
Loudly complain with dump_stack but do not halt with BUG.

Signed-off-by: Fernando Guzman Lugo <x0095840@ti.com>
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
---
drivers/dsp/bridge/wmd/tiomap3430.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c b/drivers/dsp/bridge/wmd/tiomap3430.c
index 65a21b2..f41763c 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430.c
@@ -301,7 +301,7 @@ static void bad_page_dump(u32 pa, struct page *pg)
current->comm, pg, (int)(2*sizeof(unsigned long)),
(unsigned long)pg->flags, pg->mapping,
page_mapcount(pg), page_count(pg));
- BUG();
+ dump_stack();
}

/*
@@ -1707,9 +1707,10 @@ static DSP_STATUS WMD_BRD_MemUnMap(struct WMD_DEV_CONTEXT *hDevContext,
"COUNT 0 FOR PA 0x%x, size = "
"0x%x\n", pAddr, ulNumBytes);
bad_page_dump(pAddr, pg);
+ } else {
+ SetPageDirty(pg);
+ page_cache_release(pg);
}
- SetPageDirty(pg);
- page_cache_release(pg);
pAddr += HW_PAGE_SIZE_4KB;
}
if (HW_MMU_PteClear(pteAddrL2, vaCurr, pteSize)
@@ -1772,9 +1773,10 @@ skip_coarse_page:
"COUNT 0 FOR PA 0x%x, size = "
"0x%x\n", pAddr, ulNumBytes);
bad_page_dump(pAddr, pg);
+ } else {
+ SetPageDirty(pg);
+ page_cache_release(pg);
}
- SetPageDirty(pg);
- page_cache_release(pg);
}
pAddr += HW_PAGE_SIZE_4KB;
}
--
1.6.2.4