Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2828343pxb; Mon, 1 Nov 2021 02:40:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZAklCj6YaihYhYFgjrnSx9n3Ju+LWM4F9B/Stui8ZXr+IMO76BZUwJNXFd/bH4Sx5GKn8 X-Received: by 2002:a17:906:7c4:: with SMTP id m4mr35704239ejc.18.1635759646417; Mon, 01 Nov 2021 02:40:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635759646; cv=none; d=google.com; s=arc-20160816; b=Qhz6tIN+KYCH7eiRlbL4kTxlonyOTPCpT1YzhBqcS5ppMh7LUavlnWTBjZhFp4whS2 OweShuCcouyIgIMIU8Gy4NUia7h69qaSotd+T963R+e4Kn/F96C0sq5k04MXU1LLM0du JMIBKLHDmoKlZ1Ioj6KJ8jggefOxE3PcvZQc9ZSuezJCqfpoEezQUIm2/QuDnjBi/je6 +fUY3Q4vWo1Ao1VwYMhU2NBFKghfhHq/Cspj1M9BiErxkyKVu7EDxRTDWifeifyjQE6n EsaB98FauPmfagwWWirsqJ1UyezS0rbZidlE1PgPQSJrFZ29WriMRcfUOmbmuuFY0EdX ZO4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bRgwTv8eDonLVdz36eeqLOPRvL0EE+ft37bN9vL27M4=; b=w33OoVf9CybfNF8zEsHwVYYcavwg5IQL4iJ/yiBjvLSyZ2l4LmPEqnj59A4zSQe8Rl 4Juh5as05ItxOI55qrLsMFUs0Pw7zuI6c7lL5T7Ab9vTMfEL0TqK8bPNj2UT+9nBLVWb R8zTLUCpn/nm/h8CCTMBUu/6neL3OsS6dEUYJ31I2RVUB6jXDj4KqEJXq6MfGc+1fI7m b0U41z8a0L7w5yrGoqhTKyKc5xzTcFyKgzRAeugfLz7I0uEOeEGupGJ3xzLLdmECg32R bfaROE8YaQ42kDfZzJTyXb+uPbJWzu6nmg7gl7Nc7TL+fU7KMQCXiqlKG5QXzaT4h5qI AgOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t9QwSQJb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sd37si23670437ejc.13.2021.11.01.02.40.21; Mon, 01 Nov 2021 02:40:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t9QwSQJb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233936AbhKAJi2 (ORCPT + 99 others); Mon, 1 Nov 2021 05:38:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:43646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233245AbhKAJfx (ORCPT ); Mon, 1 Nov 2021 05:35:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 536B961101; Mon, 1 Nov 2021 09:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635758767; bh=iLqvUfGOzcTvBkKwoy4yHgnn1Qocynembbf3asBRqT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t9QwSQJbMcsjQP4jDxCbyTYR3W+9Khzz17CymLgj80eYtYXzVy3Uu6xyN0aXlMqpd mfEm8wCfRv+O3fP0vl10EWwRaTFfTxTrHQf40846p0lA/30dOAWZb0lKAm9jT4hTGN rMkff8WMH/G1Utyn9WRo1tabvO49yOseRHsF2PI4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janusz Dziedzic , Johannes Berg Subject: [PATCH 5.10 51/77] cfg80211: correct bridge/4addr mode check Date: Mon, 1 Nov 2021 10:17:39 +0100 Message-Id: <20211101082522.465847188@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082511.254155853@linuxfoundation.org> References: <20211101082511.254155853@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Janusz Dziedzic commit 689a0a9f505f7bffdefe6f17fddb41c8ab6344f6 upstream. Without the patch we fail: $ sudo brctl addbr br0 $ sudo brctl addif br0 wlp1s0 $ sudo iw wlp1s0 set 4addr on command failed: Device or resource busy (-16) Last command failed but iface was already in 4addr mode. Fixes: ad4bb6f8883a ("cfg80211: disallow bridging managed/adhoc interfaces") Signed-off-by: Janusz Dziedzic Link: https://lore.kernel.org/r/20211024201546.614379-1-janusz.dziedzic@gmail.com [add fixes tag, fix indentation, edit commit log] Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/wireless/util.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -1028,14 +1028,14 @@ int cfg80211_change_iface(struct cfg8021 !(rdev->wiphy.interface_modes & (1 << ntype))) return -EOPNOTSUPP; - /* if it's part of a bridge, reject changing type to station/ibss */ - if (netif_is_bridge_port(dev) && - (ntype == NL80211_IFTYPE_ADHOC || - ntype == NL80211_IFTYPE_STATION || - ntype == NL80211_IFTYPE_P2P_CLIENT)) - return -EBUSY; - if (ntype != otype) { + /* if it's part of a bridge, reject changing type to station/ibss */ + if (netif_is_bridge_port(dev) && + (ntype == NL80211_IFTYPE_ADHOC || + ntype == NL80211_IFTYPE_STATION || + ntype == NL80211_IFTYPE_P2P_CLIENT)) + return -EBUSY; + dev->ieee80211_ptr->use_4addr = false; dev->ieee80211_ptr->mesh_id_up_len = 0; wdev_lock(dev->ieee80211_ptr);