If completing paging read in pre-read, the stream handle context not released.

Hi all,

I just noticed one scenario in my minifilter codes. when I return FLT_PREOP_COMPLETE in the pre-read for paging IRP, the stream handle is never released until unload the filter driver.

I understand the FSD may hold some refer to the file object before issuing the paging read IRP. if the paging IRP is never be sent to the low level by some filter, then the pointer is not released.

I am trying to avoid this situation by not completing paging read IRP in my codes.

However I am curious to know whether my understanding is correct. Could you please provide some comments?

Thanks,
Wilson

In subject you’re talking about “stream handle context”. But in body of your
message you say just “stream handle”. These are two different things.

If you get a “stream handle context” with e.g. FltGetStreamHandleContext
you’ll have to call FltReleaseContext somewhat later.

Releasing a “stream handle” in my understanding is “dereferencing a file
object”. Which (as far as I know) is not your task unless you’ve referenced
it before.

wrote news:xxxxx@ntfsd…
> Hi all,
>
> I just noticed one scenario in my minifilter codes. when I return
> FLT_PREOP_COMPLETE in the pre-read for paging IRP, the stream handle is
> never released until unload the filter driver.
>
> I understand the FSD may hold some refer to the file object before issuing
> the paging read IRP. if the paging IRP is never be sent to the low level
> by some filter, then the pointer is not released.
>
> I am trying to avoid this situation by not completing paging read IRP in
> my codes.
>
> However I am curious to know whether my understanding is correct. Could
> you please provide some comments?
>
> Thanks,
> Wilson
>