On Tue, Feb 9, 2010 at 10:22 PM, Guzman Lugo, Fernando <x0095840@xxxxxx> wrote: > The root problem here is that remove the DMM element should be in PROC_UnMap but in PROC_UnReserveMemory, because apart of the problem your are seeing about memory corruption if the application does a PROC_ReserveMemory and then it finished unexpectedly the resource cleanup wont be able to unreserved the memory because there is no a DMMres element in process context struct, the same applies in the case of application calls PROC_ReserveMemory, PROC_Map, PROC_UnMap but fails to do the PROC_UnReserveMemory. No, that's a completely different issue, but also valid. > So the right solution should be: > > 1 .- Remove DRV_InsertDMMResElement function from PROC_Map and put it on PROC_ReserveMemory. > > 2.- Keep DRV_UpdateDMMResElement function in PROC_Map. > > 3.- Remove DRV_RemoveDMMResElement function from PROC_UnMap and put it on ROC_UnReserveMemory function. > > 4.- Clear dmmAllocated flag in PROC_UnMap: > > pDMMRes->dmmAllocated = 0; At this point there's an obvious question; what's the point of reserving a memory region and not mapping it? I remember the answer from Hari was: some clients prefer to reserve a big region once, and map parts of it continuously. I have my doubts that the use-case even works with the current code-base. But assuming it does work, your proposed changes would break it. It would be much easier to merge the two functions into one. Anyway, please re-read Ameya's description carefully. -- Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html