From patchwork Wed Jan 31 15:49:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 768815 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76DC71272C2 for ; Wed, 31 Jan 2024 15:49:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706716157; cv=none; b=trYwTbaTDDlcWEJdqQce73/y4yWy2TmlXoohwDehEeF7SqmdTW+aShZ1VgicKU4lMA3590l83LZi6dByM07yxEy5Ahe30jKsvgMWqWvthjljWYNx+usT77ir6q049qO1JfV4vPixcL8pYz7HleOAFwnhlGb3A+uvkCtUHB4+N7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706716157; c=relaxed/simple; bh=EDJBlGOZIg7sQHe5vVGY0rX1UQL9mV6FOaqCjNWVaKg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=M36Dot5J3Jsy4mY1zo3XaFJDP1iIfBaZoViaxO0LPXaXlwQba+H/JyYpJS5Hx7UIpEw7zBNR9PC1wiGSPqNo49yoBRfpzffja5GDWEZTrzWJjNmsePYUDQFheKuV2MsfWIFQfimqRX/4leAXkVLadRewacexO2vfnd9hygWn/vI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=HHPuAwo1; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="HHPuAwo1" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: 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:In-Reply-To:References; bh=btubioyR2fFfIYDoOan9wS7Qu+T9HRF2ymUqAOR0Izw=; t=1706716155; x=1707925755; b=HHPuAwo1SVi3MyphphNONXSfFCra2WejUrqcm7DjkBtN1dlvtXZLk4xzOxTCqnUIQ5nVsLQ6v43 Rt7ZaMB+njErWrYSpYf/9Gwfy/8ubt/tSH7dPxaNGZtH08/PC92eIywosy7fWSnipkMX53uN7BbZQ FLRRNljiiekjTSWgGgVJwFk7qDkxA7D2mpDaF0vIzqfrRHVYJbQbM1Fn9VJ3T5s7rrXWyWazc5nSi HyLNqWFiXaS1N7OV6tPC5lwJFyK2q/17P0D++RajHe7rEZF6ydAL+jgA9ccefmNV4rZpYwp3zo3Ih 7SxzVfxev2HWrsYJdkVKReQpeptUqZ6JVZHA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rVCps-00000007JCD-21KT; Wed, 31 Jan 2024 16:49:12 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg Subject: [PATCH 1/2] wifi: mac80211: reload info pointer in ieee80211_tx_dequeue() Date: Wed, 31 Jan 2024 16:49:10 +0100 Message-ID: <20240131164910.b54c28d583bc.I29450cec84ea6773cff5d9c16ff92b836c331471@changeid> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg This pointer can change here since the SKB can change, so we actually later open-coded IEEE80211_SKB_CB() again. Reload the pointer where needed, so the monitor-mode case using it gets fixed, and then use info-> later as well. Signed-off-by: Johannes Berg --- net/mac80211/tx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index f57f7963ca37..c2e4ef327377 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -5,7 +5,7 @@ * Copyright 2006-2007 Jiri Benc * Copyright 2007 Johannes Berg * Copyright 2013-2014 Intel Mobile Communications GmbH - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2024 Intel Corporation * * Transmit and frame generation functions. */ @@ -3922,6 +3922,7 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, goto begin; skb = __skb_dequeue(&tx.skbs); + info = IEEE80211_SKB_CB(skb); if (!skb_queue_empty(&tx.skbs)) { spin_lock_bh(&fq->lock); @@ -3966,7 +3967,7 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, } encap_out: - IEEE80211_SKB_CB(skb)->control.vif = vif; + info->control.vif = vif; if (tx.sta && wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) { From patchwork Wed Jan 31 15:49:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 769507 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43BA912AAF3 for ; Wed, 31 Jan 2024 15:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706716158; cv=none; b=mYhDowTB86qV8CiIXZ4nLMIGybvQ9YBK6ix4z1HTqGiIhJRYz65oCrXV7mjvaxLCYu5nty9knC5Is6PCfw27AhnVgjGTJY+Ahdtvp8VuJNgx75MJgRe8rTM6Scg6zPau23IERGVsIW3V/ku3C2i2/KLpX7jEdAJGME/gPCp226s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706716158; c=relaxed/simple; bh=l8VkQeiKug/L7jNus8NvW7gkJyItBTlW37bVno0m0xg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o5zYeeyJ1zTVOZqzaxCiWcxc5UuMbmpYgPSoXNIMMfyjZhLR2Z3FAtJOzC+fnWe40+ZrFYPw8RK3ff/paORqvKiRcPeW/aHlVtDp+Y5MLj4N63BEnB1OInLtbWNEEwS4b8p3SXa+7rAKsgyGnDmUdsWCLyJ45VgpFD8PcF0fczo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=SAjrJ4Eh; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="SAjrJ4Eh" 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=ujA/OOWj/HT0MccQRJvV7GwmEzoXdUuYfpobrVNiVko=; t=1706716156; x=1707925756; b=SAjrJ4EhHF/Kd78C3a3gwmPM78ndz3EhXwormrTzKlzoUZm cMphXKF0jmrOrYcyG96Aip+uDXR50pJ8u+QXJgS0h8d/kRJ5KDpQQ/YqvFCEOfpyRTAvAUw8uw0sc bDmHgvRvZbvYjT6IW2ssv6J2Aqy2LZbrbqePQqJSNsgDzZHVVH7nQdYLFOjnTGt9dYF4d6Nyg5i14 msYLvp65h5YAPgOjULACMOfKdw2Xf9oJhZKK3dGHUaOZCC+4YFXFpb+rWUOScGpMhWFXIloYJa6VK 3+v/zzev7gvl2ZY//3iVeNLDuWdgt6mOmgP9inowtA9e3uAXtB5KY702piIX84Rw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rVCpt-00000007JCD-3J2U; Wed, 31 Jan 2024 16:49:13 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg Subject: [PATCH 2/2] wifi: mac80211: clarify vif handling in TX dequeue Date: Wed, 31 Jan 2024 16:49:11 +0100 Message-ID: <20240131164910.60066625a239.Idfb6a5a9876f9f631eae760055e1c4018259a971@changeid> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240131164910.b54c28d583bc.I29450cec84ea6773cff5d9c16ff92b836c331471@changeid> References: <20240131164910.b54c28d583bc.I29450cec84ea6773cff5d9c16ff92b836c331471@changeid> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg The vif pointer at least looks like it can actually be NULL in some cases such as the monitor-mode vif, causing static checkers to complain with the immediate derefence. In these cases the sta pointer will also be NULL, but clarify it in the code anyway. Signed-off-by: Johannes Berg --- net/mac80211/tx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index c2e4ef327377..c3e67e40dc9a 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3954,7 +3954,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, ieee80211_free_txskb(&local->hw, skb); goto begin; } else { - vif = NULL; + info->control.vif = NULL; + return skb; } break; case NL80211_IFTYPE_AP_VLAN: