Commit 9c5d3afa authored by Johannes Berg's avatar Johannes Berg
Browse files

mac80211_hwsim: check that n_limits makes sense



Under certain circumstances, radios created via netlink could
have n_limits be zero and no possible interface types, which
makes no sense. Reject this early to prevent a WARN_ON() in
cfg80211.

Fixes: 99e3a44b ("mac80211_hwsim: allow setting iftype support")
Reported-by: default avatar <syzbot+73fd8b0aa60c67fa4b60@syzkaller.appspotmail.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 8a7fa0c3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2761,6 +2761,11 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
					BIT(NL80211_CHAN_WIDTH_160);
	}

	if (!n_limits) {
		err = -EINVAL;
		goto failed_hw;
	}

	data->if_combination.n_limits = n_limits;
	data->if_combination.max_interfaces = 2048;
	data->if_combination.limits = data->if_limits;