public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DSPBRIDGE:Fix Kernel memory poison overwritten after DSP_MMUFAULT
@ 2010-04-13 16:46 Deepak Chitriki
  2010-04-13 16:54 ` Deepak Chitriki
  0 siblings, 1 reply; 12+ messages in thread
From: Deepak Chitriki @ 2010-04-13 16:46 UTC (permalink / raw)
  To: linux-omap; +Cc: Deepak Chitriki

kmalloc() does not guarantee page aligned memory always,hence
resulting in virtual addresses not getting aligned to page boundary.
This patch replaces kmalloc() with __get_free_pages() which
allocates kernel memory in terms of PAGES fixing the Kernel
memory corruption after DSP_MMUFAULT.

Signed-off-by: Deepak Chitriki <deepak.chitriki@ti.com>
---
 drivers/dsp/bridge/wmd/ue_deh.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/ue_deh.c b/drivers/dsp/bridge/wmd/ue_deh.c
index 14dd8ae..7ed5f60 100644
--- a/drivers/dsp/bridge/wmd/ue_deh.c
+++ b/drivers/dsp/bridge/wmd/ue_deh.c
@@ -239,7 +239,8 @@ void bridge_deh_notify(struct deh_mgr *hdeh_mgr, u32 ulEventMask, u32 dwErrInfo)
 			       "bridge_deh_notify: DSP_MMUFAULT, fault "
 			       "address = 0x%x\n", (unsigned int)fault_addr);
 			dummy_va_addr =
-			    (u32) mem_calloc(sizeof(char) * 0x1000, MEM_PAGED);
+			    (void *)__get_free_pages(GFP_ATOMIC | __GFP_ZERO,
+						     0);
 			mem_physical =
 			    VIRT_TO_PHYS(PG_ALIGN_LOW
 					 ((u32) dummy_va_addr, PG_SIZE4K));
@@ -338,6 +339,6 @@ dsp_status bridge_deh_get_info(struct deh_mgr *hdeh_mgr,
  */
 void bridge_deh_release_dummy_mem(void)
 {
-	kfree((void *)dummy_va_addr);
+	free_pages((void *)dummy_va_addr, 0);
 	dummy_va_addr = 0;
 }
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [PATCH] DSPBRIDGE:Fix Kernel memory poison overwritten after DSP_MMUFAULT
@ 2010-04-13 16:55 Deepak Chitriki
  2010-04-19 18:25 ` Guzman Lugo, Fernando
  0 siblings, 1 reply; 12+ messages in thread
From: Deepak Chitriki @ 2010-04-13 16:55 UTC (permalink / raw)
  To: linux-omap
  Cc: Deepak Chitriki, Ameya Palande, Felipe Contreras, Hiroshi Doyu,
	Omar Ramirez Luna, Nishanth Menon

kmalloc() does not guarantee page aligned memory always,hence
resulting in virtual addresses not getting aligned to page boundary.
This patch replaces kmalloc() with __get_free_pages() which
allocates kernel memory in terms of PAGES fixing the Kernel
memory corruption after DSP_MMUFAULT.

Cc: Ameya Palande <ameya.palande@nokia.com>
Cc: Felipe Contreras <felipe.contreras@nokia.com>
Cc: Hiroshi Doyu <hiroshi.doyu@nokia.com>
Cc: Omar Ramirez Luna <omar.ramirez@ti.com>
Cc: Nishanth Menon <nm@ti.com>

Signed-off-by: Deepak Chitriki <deepak.chitriki@ti.com>
---
 drivers/dsp/bridge/wmd/ue_deh.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/ue_deh.c b/drivers/dsp/bridge/wmd/ue_deh.c
index 14dd8ae..7ed5f60 100644
--- a/drivers/dsp/bridge/wmd/ue_deh.c
+++ b/drivers/dsp/bridge/wmd/ue_deh.c
@@ -239,7 +239,8 @@ void bridge_deh_notify(struct deh_mgr *hdeh_mgr, u32 ulEventMask, u32 dwErrInfo)
 			       "bridge_deh_notify: DSP_MMUFAULT, fault "
 			       "address = 0x%x\n", (unsigned int)fault_addr);
 			dummy_va_addr =
-			    (u32) mem_calloc(sizeof(char) * 0x1000, MEM_PAGED);
+			    (void *)__get_free_pages(GFP_ATOMIC | __GFP_ZERO,
+						     0);
 			mem_physical =
 			    VIRT_TO_PHYS(PG_ALIGN_LOW
 					 ((u32) dummy_va_addr, PG_SIZE4K));
@@ -338,6 +339,6 @@ dsp_status bridge_deh_get_info(struct deh_mgr *hdeh_mgr,
  */
 void bridge_deh_release_dummy_mem(void)
 {
-	kfree((void *)dummy_va_addr);
+	free_pages((void *)dummy_va_addr, 0);
 	dummy_va_addr = 0;
 }
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-05-14 12:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-13 16:46 [PATCH] DSPBRIDGE:Fix Kernel memory poison overwritten after DSP_MMUFAULT Deepak Chitriki
2010-04-13 16:54 ` Deepak Chitriki
  -- strict thread matches above, loose matches on Subject: below --
2010-04-13 16:55 Deepak Chitriki
2010-04-19 18:25 ` Guzman Lugo, Fernando
2010-05-12 19:39   ` Felipe Contreras
2010-05-12 21:09     ` Guzman Lugo, Fernando
2010-05-13 11:39       ` Felipe Contreras
2010-05-13 17:29         ` Guzman Lugo, Fernando
2010-05-13 18:29           ` Felipe Contreras
2010-05-13 21:15             ` Guzman Lugo, Fernando
2010-05-13 22:33               ` Felipe Contreras
2010-05-14 12:08         ` Felipe Contreras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox