3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 10:39:23 +01:00

station: fix use-after-free on neighbor reports

When netdev goes down so does station, but prior to netdev calling
the neighbor report callback. The way the logic was written station
is dereferenced prior to checking for any errors, causing a use
after free.

Since -ENODEV is used in this case check for that early before
accessing station.
This commit is contained in:
James Prestwood 2021-09-23 15:57:26 -07:00 committed by Denis Kenzior
parent cf0f6ebddf
commit b6884df39a

View File

@ -1708,6 +1708,9 @@ static void station_early_neighbor_report_cb(struct netdev *netdev, int err,
{
struct station *station = user_data;
if (err == -ENODEV)
return;
l_debug("ifindex: %u, error: %d(%s)",
netdev_get_ifindex(station->netdev),
err, err < 0 ? strerror(-err) : "");
@ -2280,6 +2283,9 @@ static void station_neighbor_report_cb(struct netdev *netdev, int err,
struct scan_freq_set *freq_set;
int r;
if (err == -ENODEV)
return;
l_debug("ifindex: %u, error: %d(%s)",
netdev_get_ifindex(station->netdev),
err, err < 0 ? strerror(-err) : "");