[ofw] [RFC] [PATCH 2/4] mthca: respond to query interface IOCTL

Fab Tillier ftillier at windows.microsoft.com
Tue Apr 22 16:40:25 PDT 2008


>Index: hca_pnp.c
>===================================================================
>--- hca_pnp.c   (revision 1006)
>+++ hca_pnp.c   (working copy)
>@@ -1249,7 +1260,114 @@
> }
>
>
>+static VOID
>+__hca_noop( VOID *context )
>+{
>+       UNREFERENCED_PARAMETER(context);
>+}
>+
>+
> static NTSTATUS
>+__query_ci_ifc(
>+       IN                                      DEVICE_OBJECT* const            p_dev_obj,
>+       IN                                      IO_STACK_LOCATION* const        p_io_stack )
>+{

Snip...

>+       p_ifc->InterfaceHeader.InterfaceReference = __hca_noop;
>+       p_ifc->InterfaceHeader.InterfaceDereference = __hca_noop;

Why isn't this ObReferenceObject and ObDereferenceObject?  You should make sure that you can't go away while someone has your interface.  If you change it to ObReferenceObject you need to take a reference before returning the interface.

-Fab



More information about the ofw mailing list