Re: [PATCH 1/2] scan: fix invalid read when canceling an ongoing scan

James Prestwood
2024-09-05T11:55:21Z

Hi Denis,

On 9/4/24 8:23 PM, Denis Kenzior wrote:
> Hi James,
>
>>>
>>> The issue seems to be resolved by checking that results->sr is set:
>>>
>>> - if (!results->sr->canceled)
>>> + if (results->sr && !results->sr->canceled)
>> The patch on the arch issue report looks good to me. Can we go ahead
>> and just send that patch with git send-email?
>
> Why is results->sr NULL?
>
> Is it caused by the cancellation path introduced by:
> 64d68b4f080c ("scan: fix invalid read when canceling an ongoing scan")
> ?
>
> Or is this caused by calling scan_get_results with a NULL sr like in
> scan_notify()?  If sr is NULL, perhaps we shouldn't be invoking the
> survey path in the first place?
I'm looking more into this. Its related to an external scan which I can
now reproduce if I just remove my network profile and let IWD periodic
scan then issue an external one. Worse though is I see more invalid
reads related to the survey code path (when periodic scanning) so there
is more to it than I originally thought.
>
> Regards,
> -Denis