Re: [PATCH v2] wifi:Remove passive scan on new active scan

Michael Nazzareno Trimarchi <[email protected]> Wed, 14 Jan 2026 10:51:36 +0100
Newsgroups dev.linux.lists.connman
Message-ID <CAOf5uwn7EefUAb8WsCisCLEah8+ZT9yU=L1VKBPH_k9_Sx3vWg@mail.gmail.com>
Hi

On Wed, Jan 14, 2026 at 10:48=E2=80=AFAM yaming.chen <[email protected]>=
 wrote:
>
> If BackgroundScanning is enable, the old passive scanning task
> needs to be removed when the new active scanning is triggered.
> It can prevent the old passive scan timeout handler function
> from accessing the dangling pointer after restarting the
> wpa_supplicant and wifi driver.
>
> Changes since v1:
> - Shorten the patch subject and inline code comments
>

This should not be included in the commit message, the should be under ---
---
Changes in v1:
- Shorten the patch subject and inline code comments
- Fix compatible string in socfpga_agilex_socdk_emmc.dts
- Rephase commit messages for clarity
---
plugins/wifi.c | 17 +++++++++++++----

> ---
>  plugins/wifi.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/plugins/wifi.c b/plugins/wifi.c
> index 12389fa6..96c0c127 100644
> --- a/plugins/wifi.c
> +++ b/plugins/wifi.c
> @@ -1999,13 +1999,22 @@ static int wifi_scan(struct connman_device *devic=
e,
>                 }
>         }
>
> +       /*
> +        * If BackgroundScanning is enable, the old passive scanning task
> +        * needs to be removed when the new active scanning is triggered.
> +        * It can prevent the old passive scan timeout handler function
> +        * from accessing the dangling pointer after restarting the
> +        * wpa_supplicant and wifi driver.
> +        */
> +       if (connman_setting_get_bool("BackgroundScanning") ||
> +                       wifi->scanning_type !=3D WIFI_SCANNING_PASSIVE) {
> +               connman_device_ref(device);
> +               reset_autoscan(device);
> +       }
> +
>         /* Distinguish between devices performing passive and active scan=
ning */
>         wifi_update_scanner_type(wifi, WIFI_SCANNING_ACTIVE);
>
> -       connman_device_ref(device);
> -
> -       reset_autoscan(device);
> -
>         ret =3D g_supplicant_interface_scan(wifi->interface, scan_params,
>                                                 scan_callback, device);
>         if (ret =3D=3D 0) {
> --
> 2.34.1
>


--=20
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com