Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2239758ybd; Mon, 24 Jun 2019 03:07:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPjeQBjrNi/9WehL2X1UM7oK8V4A7B6EnWr9gQAKmMFheHZl95VVvamKLOCLZgAHZ6LS+r X-Received: by 2002:a17:902:f81:: with SMTP id 1mr23637157plz.191.1561370864857; Mon, 24 Jun 2019 03:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561370864; cv=none; d=google.com; s=arc-20160816; b=oSPGYvezUiQVagXnoKyaTMyL/H4c3h2tpcNvwlUTGG9E2Ok9Hq12bOwJeTGcgj5DGr n6lJ1NatYnbEZIpN1x8RhoPAl9TWBG6kHyX9rxbdwBHJDgwqvJKGm56la93h+aOowQgf ujqFXfROUC70YeIdxcDIh+yuqjiCEhqwsPvSOCyJaTrqDPYCb+kgBzk1Xa/z5VziZP2C +U3wur+9BA4t46dODWRAUYdizd4pbKQw39aJC15OKox+ZD5d7IsioA1gsCSpVSIkWTUY m+dw0Q+C4dHA5xaHzDJNO0yYwN4ebkzzQah4SL6+jFvaGiqOnAd7wqRi0k8KlOqAcKt4 cxOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v7oO2fW1MfYCYHeR5+GYQytWP30H3Ap/k/2q18bhP0I=; b=B1tk8x/saUeKWpApIjBqvTOR6QfqFD+RYog/5PyenmrqSH4F2WWZkJcAiReSA2C1r5 XV0jtaB/EPDXu3/YF6XHwdRGsUei0vdA/N2do5b16lezGodD8nafvqjiSzZ2bXYZSxg/ oAkJSvBvf/sTD1FQE/w0ITBpHWPMWH8q5ii0PnCwK8X4UTJVwsog8o20BpnOOh0sZMs8 bDDzrvViZmFI3eI4kzQWr6KcUtktJ+4mXRMC4d145RCkvWv2roK3Nlx8onnErD/hkwYT TVjuJep0Pwax04Lq2wbI6qjeTBwnneEpsIg1OBU+E2qeLLt7ghwHjuhk/efIJUF+7lTm yu7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y6qJpe+g; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si10602600pjw.61.2019.06.24.03.07.28; Mon, 24 Jun 2019 03:07:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y6qJpe+g; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730141AbfFXKGg (ORCPT + 99 others); Mon, 24 Jun 2019 06:06:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:38778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730128AbfFXKGd (ORCPT ); Mon, 24 Jun 2019 06:06:33 -0400 Received: from localhost (f4.8f.5177.ip4.static.sl-reverse.com [119.81.143.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5BDEC208E3; Mon, 24 Jun 2019 10:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561370792; bh=u23his4SYTuHLnCYKJPVyEumvJOfIF+cHac3gNS6sTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y6qJpe+gy0uRKLnbMvVs+yK0PJcLtzQOsUV4+uxGkVBwuo8+cNsN1/84oJgnbrUCN voh9BC4284tEk/5YkrAECm+y8joCqVrpuawM7ckDJT1LarbyPRC4dWSFoB2xv/xbVg tPdyMfXtIJbZHUhKKCCNMof/FL/xjmpzqDZAt5Vk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manikanta Pubbisetty , Johannes Berg Subject: [PATCH 4.19 86/90] {nl,mac}80211: allow 4addr AP operation on crypto controlled devices Date: Mon, 24 Jun 2019 17:57:16 +0800 Message-Id: <20190624092319.527759149@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190624092313.788773607@linuxfoundation.org> References: <20190624092313.788773607@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Manikanta Pubbisetty commit 33d915d9e8ce811d8958915ccd18d71a66c7c495 upstream. As per the current design, in the case of sw crypto controlled devices, it is the device which advertises the support for AP/VLAN iftype based on it's ability to tranmsit packets encrypted in software (In VLAN functionality, group traffic generated for a specific VLAN group is always encrypted in software). Commit db3bdcb9c3ff ("mac80211: allow AP_VLAN operation on crypto controlled devices") has introduced this change. Since 4addr AP operation also uses AP/VLAN iftype, this conditional way of advertising AP/VLAN support has broken 4addr AP mode operation on crypto controlled devices which do not support VLAN functionality. In the case of ath10k driver, not all firmwares have support for VLAN functionality but all can support 4addr AP operation. Because AP/VLAN support is not advertised for these devices, 4addr AP operations are also blocked. Fix this by allowing 4addr operation on devices which do not support AP/VLAN iftype but can support 4addr AP operation (decision is based on the wiphy flag WIPHY_FLAG_4ADDR_AP). Cc: stable@vger.kernel.org Fixes: db3bdcb9c3ff ("mac80211: allow AP_VLAN operation on crypto controlled devices") Signed-off-by: Manikanta Pubbisetty Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- include/net/cfg80211.h | 3 ++- net/mac80211/util.c | 4 +++- net/wireless/core.c | 6 +++++- net/wireless/nl80211.c | 8 ++++++-- 4 files changed, 16 insertions(+), 5 deletions(-) --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -3448,7 +3448,8 @@ struct cfg80211_ops { * on wiphy_new(), but can be changed by the driver if it has a good * reason to override the default * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station - * on a VLAN interface) + * on a VLAN interface). This flag also serves an extra purpose of + * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype. * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the * control port protocol ethertype. The device also honours the --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -3523,7 +3523,9 @@ int ieee80211_check_combinations(struct } /* Always allow software iftypes */ - if (local->hw.wiphy->software_iftypes & BIT(iftype)) { + if (local->hw.wiphy->software_iftypes & BIT(iftype) || + (iftype == NL80211_IFTYPE_AP_VLAN && + local->hw.wiphy->flags & WIPHY_FLAG_4ADDR_AP)) { if (radar_detect) return -EINVAL; return 0; --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -1335,8 +1335,12 @@ static int cfg80211_netdev_notifier_call } break; case NETDEV_PRE_UP: - if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) + if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)) && + !(wdev->iftype == NL80211_IFTYPE_AP_VLAN && + rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP && + wdev->use_4addr)) return notifier_from_errno(-EOPNOTSUPP); + if (rfkill_blocked(rdev->rfkill)) return notifier_from_errno(-ERFKILL); break; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3191,8 +3191,7 @@ static int nl80211_new_interface(struct return -EINVAL; } - if (!rdev->ops->add_virtual_intf || - !(rdev->wiphy.interface_modes & (1 << type))) + if (!rdev->ops->add_virtual_intf) return -EOPNOTSUPP; if ((type == NL80211_IFTYPE_P2P_DEVICE || type == NL80211_IFTYPE_NAN || @@ -3211,6 +3210,11 @@ static int nl80211_new_interface(struct return err; } + if (!(rdev->wiphy.interface_modes & (1 << type)) && + !(type == NL80211_IFTYPE_AP_VLAN && params.use_4addr && + rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP)) + return -EOPNOTSUPP; + err = nl80211_parse_mon_options(rdev, type, info, ¶ms); if (err < 0) return err;