wifi: fix list corruption when scanning with explicit SSID
Summary
Calling c_list_link_tail()
on a list entry that already belongs to
another list corrupts the other list, in this case 'old_lst_head
';
this is explained in the documentation of c_list_link_before()
:
* @what is not inspected prior to being linked. Hence, it better not
* be linked into another list, or the other list will be corrupted.
This can be reproduced by invoking "nmcli device wifi rescan ssid x"
multiple times; in this way, _scan_request_ssids_track()
reuses the
previous SSID data, the list gets corrupted and this causes a crash.
Fixes: 7500e90b ('wifi: rework scanning of Wi-Fi device')