From nobody Fri Sep 19 07:20:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42692C4332F for ; Mon, 7 Nov 2022 20:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232517AbiKGU2y (ORCPT ); Mon, 7 Nov 2022 15:28:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232934AbiKGU2r (ORCPT ); Mon, 7 Nov 2022 15:28:47 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 581DA205FA for ; Mon, 7 Nov 2022 12:28:46 -0800 (PST) Received: from ipservice-092-217-067-198.092.217.pools.vodafone-ip.de ([92.217.67.198] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1os8jW-0004bP-PW; Mon, 07 Nov 2022 21:28:38 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser , Dan Carpenter Subject: [PATCH v2 1/3] staging: r8188eu: use a qos_hdr in validate_recv_data_frame Date: Mon, 7 Nov 2022 21:28:22 +0100 Message-Id: <20221107202824.61431-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221107202824.61431-1-martin@kaiser.cx> References: <20221107202824.61431-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Define a struct ieee80211_qos_hdr in the validate_recv_data_frame function. Use this struct to replace some numeric offsets and make the code easier to understand. Reported-by: Dan Carpenter Signed-off-by: Martin Kaiser --- Changes in v2 - fixed hdrlen calculation drivers/staging/r8188eu/core/rtw_recv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r818= 8eu/core/rtw_recv.c index cb0f35d7ab98..5b0a66aebff1 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1032,7 +1032,6 @@ static int validate_recv_data_frame(struct adapter *a= dapter, struct recv_frame *precv_frame) { struct sta_info *psta =3D NULL; - u8 *ptr =3D precv_frame->rx_data; struct ieee80211_hdr *hdr =3D (struct ieee80211_hdr *)precv_frame->rx_dat= a; struct rx_pkt_attrib *pattrib =3D &precv_frame->attrib; struct security_priv *psecuritypriv =3D &adapter->securitypriv; @@ -1071,10 +1070,12 @@ static int validate_recv_data_frame(struct adapter = *adapter, pattrib->ack_policy =3D 0; /* parsing QC field */ if (pattrib->qos) { + struct ieee80211_qos_hdr *qos_hdr =3D (struct ieee80211_qos_hdr *)hdr; + pattrib->priority =3D ieee80211_get_tid(hdr); - pattrib->ack_policy =3D GetAckpolicy((ptr + 24)); - pattrib->amsdu =3D GetAMsdu((ptr + 24)); - pattrib->hdrlen =3D 26; + pattrib->ack_policy =3D GetAckpolicy(&qos_hdr->qos_ctrl); + pattrib->amsdu =3D GetAMsdu(&qos_hdr->qos_ctrl); + pattrib->hdrlen =3D sizeof(*qos_hdr); =20 if (pattrib->priority !=3D 0 && pattrib->priority !=3D 3) adapter->recvpriv.bIsAnyNonBEPkts =3D true; --=20 2.30.2 From nobody Fri Sep 19 07:20:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A479C4332F for ; Mon, 7 Nov 2022 20:28:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232291AbiKGU26 (ORCPT ); Mon, 7 Nov 2022 15:28:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232942AbiKGU2r (ORCPT ); Mon, 7 Nov 2022 15:28:47 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9795B20BE7 for ; Mon, 7 Nov 2022 12:28:46 -0800 (PST) Received: from ipservice-092-217-067-198.092.217.pools.vodafone-ip.de ([92.217.67.198] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1os8jX-0004bP-Ri; Mon, 07 Nov 2022 21:28:39 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH v2 2/3] staging: r8188eu: drop another removal/stop check Date: Mon, 7 Nov 2022 21:28:23 +0100 Message-Id: <20221107202824.61431-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221107202824.61431-1-martin@kaiser.cx> References: <20221107202824.61431-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There's no need to check bDriverStopped and bSurpriseRemoved in issue_probereq_ex. The code path looks like issue_probereq_ex _issue_probereq dump_mgntframe or dump_mgntframe_and_wait_ack All paths from dump_mgntframe check the two variables. dump_mgntframe_and_wait_ack contains a check as well. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 17803aca83c8..bfd6afd7266e 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -4496,9 +4496,6 @@ int issue_probereq_ex(struct adapter *padapter, struc= t ndis_802_11_ssid *pssid, =20 i++; =20 - if (padapter->bDriverStopped || padapter->bSurpriseRemoved) - break; - if (i < try_cnt && wait_ms > 0 && ret =3D=3D _FAIL) msleep(wait_ms); =20 --=20 2.30.2 From nobody Fri Sep 19 07:20:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C2FFC4332F for ; Mon, 7 Nov 2022 20:28:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232950AbiKGU2v (ORCPT ); Mon, 7 Nov 2022 15:28:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232895AbiKGU2q (ORCPT ); Mon, 7 Nov 2022 15:28:46 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F4C3201A2 for ; Mon, 7 Nov 2022 12:28:46 -0800 (PST) Received: from ipservice-092-217-067-198.092.217.pools.vodafone-ip.de ([92.217.67.198] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1os8jZ-0004bP-6j; Mon, 07 Nov 2022 21:28:41 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH v2 3/3] staging: r8188eu: drop removal/stop check in dump_mgntframe_and_wait_ack Date: Mon, 7 Nov 2022 21:28:24 +0100 Message-Id: <20221107202824.61431-4-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221107202824.61431-1-martin@kaiser.cx> References: <20221107202824.61431-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" We can remove the checks for bDriverStopped and bSurpriseRemoved in dump_mgntframe_and_wait_ack. The code path from this function looks like dump_mgntframe_and_wait_ack rtl8188eu_mgnt_xmit rtw_dump_xframe loop over all fragments rtw_write_port is called for each fragment. bSurpriseRemoved and bDriverStopped are checked in rtw_write_port. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index bfd6afd7266e..be33489d3dfd 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3988,9 +3988,6 @@ s32 dump_mgntframe_and_wait_ack(struct adapter *padap= ter, struct xmit_frame *pmg u32 timeout_ms =3D 500;/* 500ms */ struct xmit_priv *pxmitpriv =3D &padapter->xmitpriv; =20 - if (padapter->bSurpriseRemoved || padapter->bDriverStopped) - return -1; - mutex_lock(&pxmitpriv->ack_tx_mutex); pxmitpriv->ack_tx =3D true; =20 --=20 2.30.2