]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Zero num_modes if nl80211_get_hw_feature_data() fails
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Wed, 28 Dec 2016 13:47:07 +0000 (15:47 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 5 Jan 2017 14:22:53 +0000 (16:22 +0200)
It was possible that nl80211_get_hw_feature_data() function would return
NULL when num_modes is not set to zero. This might result in a later crash
when accessing hw.modes. This may be reproduced with hwsim oom tests, for
example, dbus_connect_oom.
Fix that by zeroing num_modes if NULL is returned.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
src/drivers/driver_nl80211_capa.c

index 1baffefbedc1f646258f6bcd12f0ffeb93f8378c..cad397046a1555c517da44ba8b0978ce0d65482d 100644 (file)
@@ -1783,6 +1783,7 @@ nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags)
                                os_free(result.modes[i].rates);
                        }
                        os_free(result.modes);
+                       *num_modes = 0;
                        return NULL;
                }
                return wpa_driver_nl80211_postprocess_modes(result.modes,