Hi Ernesto,

On Tue, 2010-02-09 at 18:09 +0100, ext Ramos Falcon, Ernesto wrote:
> From 991bd676e160a5500cb511a78afcac838ff003e4 Mon Sep 17 00:00:00 2001
> From: Ernesto Ramos <erne...@ti.com>
> Date: Fri, 29 Jan 2010 20:00:26 -0600
> Subject: [PATCH] DSPBRIDGE: Validate stream handle from user.
> 
> Add checks to verify strm handle from user.
> 
> Signed-off-by: Ernesto Ramos <erne...@ti.com>
> ---
>  drivers/dsp/bridge/pmgr/wcd.c  |   42 +++++++++++++
>  drivers/dsp/bridge/rmgr/strm.c |  134 ++++++++++++++++-----------------------
>  2 files changed, 97 insertions(+), 79 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
> index 2e6eeb0..78c7acd 100644
> --- a/drivers/dsp/bridge/pmgr/wcd.c
> +++ b/drivers/dsp/bridge/pmgr/wcd.c
> @@ -1517,6 +1517,22 @@ func_cont:
>       return status;
>  }
>  
> +
> +bool validate_strm_handle(struct STRM_OBJECT *hStrm, void *pr_ctxt)
> +{
> +     bool retVal = false;
> +     struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
> +     struct STRM_RES_OBJECT *pStrm = pCtxt->pSTRMList;
> +
> +     while (pStrm && !retVal) {
> +             if (hStrm == pStrm->hStream)

If you have several streams allocated by user space, then what you are
validating here is for any node! Is that ok?

This validation and design itself doesn't look good to me. If we don't
want to trust user space, then instead of checking the stream handle in
every function it is better to store all user space specific date inside
pr_context and use it from there.

Cheers,
Ameya.

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to