]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Fix handling of if_indices reallocation failure
authorJouni Malinen <j@w1.fi>
Sun, 28 Apr 2019 17:52:10 +0000 (20:52 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 28 Apr 2019 17:52:10 +0000 (20:52 +0300)
Addition of a separate if_indices_reason array broke reallocation
failure checking. drv->if_indices or drv->if_indices_reason could not be
NULL in the place where this check was moved to. Fix that by maintaining
knowledge of reallocation failure in a separate local variable.

Fixes: 732b1d20ec06 ("nl80211: Clean up ifidx properly if interface in a bridge is removed")
Signed-off-by: Jouni Malinen <j@w1.fi>
src/drivers/driver_nl80211.c

index 5da8a793b165e455a46041a4093c982ec2510179..ab2bdaf834f93c17a482fa56d06098705ccdb01d 100644 (file)
@@ -6641,6 +6641,7 @@ static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
 {
        int i;
        int *old, *old_reason;
+       int alloc_failed = 0;
 
        wpa_printf(MSG_DEBUG,
                   "nl80211: Add own interface ifindex %d (ifidx_reason %d)",
@@ -6679,14 +6680,16 @@ static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx,
                        drv->if_indices = drv->default_if_indices;
                else
                        drv->if_indices = old;
+               alloc_failed = 1;
        }
        if (!drv->if_indices_reason) {
                if (!old_reason)
                        drv->if_indices_reason = drv->default_if_indices_reason;
                else
                        drv->if_indices_reason = old_reason;
+               alloc_failed = 1;
        }
-       if (!drv->if_indices || !drv->if_indices_reason) {
+       if (alloc_failed) {
                wpa_printf(MSG_ERROR, "Failed to reallocate memory for "
                           "interfaces");
                wpa_printf(MSG_ERROR, "Ignoring EAPOL on interface %d", ifidx);