Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0fc98039 authored by Ivo van Doorn's avatar Ivo van Doorn Committed by John W. Linville
Browse files

rt2x00: Block all unsupported modes



It was possible for unsupported operating modes
to be accepted by the add_interface callback function.
This patch will block those modes until proper support
has been implemented for them.

Signed-off-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8dbc1722
Loading
Loading
Loading
Loading
+37 −17
Original line number Diff line number Diff line
@@ -203,24 +203,44 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
	    !test_bit(DEVICE_STARTED, &rt2x00dev->flags))
		return -ENODEV;

	switch (conf->type) {
	case IEEE80211_IF_TYPE_AP:
		/*
	 * We don't support mixed combinations of sta and ap virtual
	 * interfaces. We can only add this interface when the rival
	 * interface count is 0.
		 * We don't support mixed combinations of
		 * sta and ap interfaces.
		 */
	if ((conf->type == IEEE80211_IF_TYPE_AP && rt2x00dev->intf_sta_count) ||
	    (conf->type != IEEE80211_IF_TYPE_AP && rt2x00dev->intf_ap_count))
		if (rt2x00dev->intf_sta_count)
			return -ENOBUFS;

		/*
	 * Check if we exceeded the maximum amount of supported interfaces.
		 * Check if we exceeded the maximum amount
		 * of supported interfaces.
		 */
	if ((conf->type == IEEE80211_IF_TYPE_AP &&
	     rt2x00dev->intf_ap_count >= rt2x00dev->ops->max_ap_intf) ||
	    (conf->type != IEEE80211_IF_TYPE_AP &&
	     rt2x00dev->intf_sta_count >= rt2x00dev->ops->max_sta_intf))
		if (rt2x00dev->intf_ap_count >= rt2x00dev->ops->max_ap_intf)
			return -ENOBUFS;

		break;
	case IEEE80211_IF_TYPE_STA:
	case IEEE80211_IF_TYPE_IBSS:
		/*
		 * We don't support mixed combinations of
		 * sta and ap interfaces.
		 */
		if (rt2x00dev->intf_ap_count)
			return -ENOBUFS;

		/*
		 * Check if we exceeded the maximum amount
		 * of supported interfaces.
		 */
		if (rt2x00dev->intf_sta_count >= rt2x00dev->ops->max_sta_intf)
			return -ENOBUFS;

		break;
	default:
		return -EINVAL;
	}

	/*
	 * Loop through all beacon queues to find a free
	 * entry. Since there are as much beacon entries