[ofw] [PATCH] make kal_cep_config safe

Fab Tillier ftillier at windows.microsoft.com
Wed Mar 25 13:33:04 PDT 2009


Currently, kal_config_cep assumes that the CID passed in as input is always valid.  However, users can destroy CEPs at will using the UAL_DESTROY_CEP IOCTL in IBAL.  This means that a CEP could be destroyed while other kernel code is attempting to configure it, even though the CID was never explicitly exposed to user-mode.

This patch traps an invalid CID in kal_config_cep.

Signed-off-by: Fab Tillier <ftillier at microsoft.com>

Index: core/al/kernel/al_cm_cep.c
===================================================================
--- core/al/kernel/al_cm_cep.c  (revision 2057)
+++ core/al/kernel/al_cm_cep.c  (working copy)
@@ -3695,7 +3695,8 @@ kal_cep_config(

        KeAcquireInStackQueuedSpinLock( &gp_cep_mgr->lock, &hdl );
        p_cep = __lookup_cep( h_al, cid );
-       CL_ASSERT( p_cep );
+       if( p_cep == NULL )
+               return;

        p_cep->pfn_cb = pfn_cb;
        p_cep->context = context;



More information about the ofw mailing list