[PATCH 1/1] NL80211: checking for ifidx in survey handler

Jouni Malinen j
Thu Jan 30 03:43:00 PST 2014

On Tue, Jan 28, 2014 at 11:14:57AM +0530, shital jaju wrote:
> This checks if attribute ifidx is present,
> before trying to get the value of interface index.

> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> @@ -10552,7 +10552,10 @@ static int survey_handler(struct nl_msg *msg, void
> *arg)
> -       ifidx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]);
> +       if (tb[NL80211_ATTR_IFINDEX])
> +               ifidx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]);
> +       else
> +               return NL_SKIP;
>         if (!tb[NL80211_ATTR_SURVEY_INFO])
>                 return NL_SKIP;

While this would obviously do no harm and would be safe to apply, I
would like to understand why this would be needed. Is there a kernel
version somewhere that does not include NL80211_ATTR_IFINDEX in the
survey data? As far as I can see, cfg80211 adds it unconditionally to
all survey results. I think I'll apply this anyway since
driver_nl80211.c tries to follow the policy of validating all messages
from the kernel.
Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list