Re: [PATCH] DSPBRIDGE: Prevent memory corruption in DRV_ProcFreeDMMRes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 8, 2010 at 10:25 PM, Ameya Palande <ameya.palande@xxxxxxxxx> wrote:
> Background: bridge_close() has the responsibility to cleanup all the
> resources allocated by user space process. One of those resources is
> DMMRes which is used for tracking DMM resource allocation done in
> PROC_Map() and PROC_UnMap().
>
> DRV_ProcFreeDMMRes() function was used for cleaning up DMMRes has following
> problems which are fixed by this patch:
>
> 1. It access and modifies pDMMRes pointer when it is already freed by
> PROC_UnMap()
> 2. Instead of passing ulDSPAddr it passes ulDSPResAddr to PROC_UnMap() which
> will not retrive correct DMMRes element.

This patch is doing the right thing to me, however, it's a bit
difficult to review because it's doing many changes at once.

Personally I would
 1) Fix the wrong dereferences in DRV_ProcFreeDMMRes
[at this point the bug should be fixed]
[the leaks would be freed by the outer loop]

 2) Fix the wrong PROC_UnMap address passed in DRV_ProcFreeDMMRes
 3) Remove the unnecessary outer loop in DRV_RemoveAllDMMResElements
[at this point the code would actually make sense]

 4) Merge DRV_ProcFreeDMMRes into DRV_RemoveAllDMMResElements
 5) Improve coding style

The end result would be the same, but easier to see what's going on :)

Cheers.

-- 
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

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux