Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp507532imw; Wed, 13 Jul 2022 02:47:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uH6lI7Gb0dCQL7/83cYDU9hfIRyrXmN56WXaGf6siJHnykvf99d30kzqigjeFBeGlIa9EZ X-Received: by 2002:a17:902:76c8:b0:16c:1c13:9eea with SMTP id j8-20020a17090276c800b0016c1c139eeamr2604761plt.83.1657705634552; Wed, 13 Jul 2022 02:47:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657705634; cv=none; d=google.com; s=arc-20160816; b=ZbFEXJT22PfVaEJfVmh+rHatbNhbPfdT2k66JJdwAOulve51v6qRlFYLrcC2rZf6eQ 1mK9Ye+KuFdA3j1hL9lOrbIpq9A0BGKPZmLcd99Z3vccs65aQzvJSbGEa4EjwM+5hnVy agGLKIT3eQGaHXhz0AWmdl90+hJgTCbNb9IgAbfR9xRHePlcahtMsBGrIlLt+EihHCwC D/owiUPjhx1RkIoqEkDF+hxjx77WSCpejcbigtDdaCkvmhkrNR5LYPQ8bKv7Pk2Xfx4f VFEkJx3XxYg8oLQ0BydRrfaHT0YOopZOfqIu/uA159MfOOUBN0/FgvFcx5ZCE80Ez1E7 W9cQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0Hnlfk7h3sjjJxbe/5bc5EHK9aI6rOQ2u8skrMeKwsM=; b=pPUBkV2L/Wz6wsHjoINY1gIu7yZaJiCrw7exm+DB64hslUJMQKYPkUHW7cH0/GPqNe SYoT1Gi9m85iSs40C3MwxyJdDDCR0twLA0c3Y00YXRz8IVRm93+uUsbpbZBtwqWWZoqA PB4jtKbdyY1e3vouiqv4R3+Ae46AFQuVUbVIz1g1zLWqakt9vSF4rA1FEUpAbdmLwGnn zgtmv2mmb54YyHVP/DAkR3iwtsdcg0FVEdxg+XPAYXaQSeVAY76Auj6Pbenk5h6P2PHu WyvKl19iIP6nT9fB7iUK9QQ/wofoGpCf8/kDlvzC32kGjsbGGbmXmARHQTAuhMjkAnsG JY4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=NU0duGtK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c11-20020a631c4b000000b0041203feea97si15849230pgm.699.2022.07.13.02.47.06; Wed, 13 Jul 2022 02:47:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=NU0duGtK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235260AbiGMJpV (ORCPT + 65 others); Wed, 13 Jul 2022 05:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235411AbiGMJpL (ORCPT ); Wed, 13 Jul 2022 05:45:11 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA82EEEAB6 for ; Wed, 13 Jul 2022 02:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=0Hnlfk7h3sjjJxbe/5bc5EHK9aI6rOQ2u8skrMeKwsM=; t=1657705509; x=1658915109; b=NU0duGtKUEbjO3yORuZ6APrYLbDQUhUnoF8xVgBUOawh+0P 3LBzPvSCRad+62mRDAl2mlHNB0TCMKXIUDJj+VUJkpBbu/DBCbF/0QLAh0v14Sw6b3KwqK8sx6iSF aq0vHdKJyKhfjmpzyjxmV9l3thrWdkLLp8srU9oP+JpiWWAFSq/txeIpTqQhoFXCcpPLx7lvS4KQ2 utyGpSIwH94vO/iQQavIWz7I3v1N3jqinp5z7w05S6KVth4hf5bJxRXIDLeXGsMXNoANpJbEtyavt AeocIWz+qWx7enVXZcZ8rWq79zY8oBP1GF1XYQRSOfYwap1/MnJmnSd7E8DzAqGg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1oBYvb-00EgvB-Kv; Wed, 13 Jul 2022 11:45:07 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg Subject: [PATCH 11/76] wifi: nl80211: hold wdev mutex in add/mod/del link station Date: Wed, 13 Jul 2022 11:43:57 +0200 Message-Id: <20220713114425.6ae3d87939e9.I5ae7161064d870033ef792be09efaca652af31ca@changeid> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220713094502.163926-1-johannes@sipsolutions.net> References: <20220713094502.163926-1-johannes@sipsolutions.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Johannes Berg Since we deal with links, and that requires looking at wdev links, we should hold the wdev mutex for driver convenience. Signed-off-by: Johannes Berg --- net/wireless/nl80211.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 5f6cbc2d73b4..26d277c14fd4 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -15781,9 +15781,14 @@ nl80211_add_mod_link_station(struct sk_buff *skb, struct genl_info *info, if (err) return err; + wdev_lock(dev->ieee80211_ptr); if (add) - return rdev_add_link_station(rdev, dev, ¶ms); - return rdev_mod_link_station(rdev, dev, ¶ms); + err = rdev_add_link_station(rdev, dev, ¶ms); + else + err = rdev_mod_link_station(rdev, dev, ¶ms); + wdev_unlock(dev->ieee80211_ptr); + + return err; } static int @@ -15804,6 +15809,7 @@ nl80211_remove_link_station(struct sk_buff *skb, struct genl_info *info) struct link_station_del_parameters params = {}; struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct net_device *dev = info->user_ptr[1]; + int ret; if (!rdev->ops->del_link_station) return -EOPNOTSUPP; @@ -15815,7 +15821,11 @@ nl80211_remove_link_station(struct sk_buff *skb, struct genl_info *info) params.mld_mac = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]); params.link_id = nla_get_u8(info->attrs[NL80211_ATTR_MLO_LINK_ID]); - return rdev_del_link_station(rdev, dev, ¶ms); + wdev_lock(dev->ieee80211_ptr); + ret = rdev_del_link_station(rdev, dev, ¶ms); + wdev_unlock(dev->ieee80211_ptr); + + return ret; } #define NL80211_FLAG_NEED_WIPHY 0x01 -- 2.36.1