From patchwork Mon Nov 7 20:28:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 16670 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2284676wru; Mon, 7 Nov 2022 12:45:07 -0800 (PST) X-Google-Smtp-Source: AMsMyM7FLf5O/0/fHywG//3o+a7T4NL5lFH46bi0Cah/CP/2qjmzof0dgFdfDBjNrkOUECU3LY9/ X-Received: by 2002:a17:906:11d3:b0:782:2d3e:6340 with SMTP id o19-20020a17090611d300b007822d3e6340mr836825eja.234.1667853906988; Mon, 07 Nov 2022 12:45:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667853906; cv=none; d=google.com; s=arc-20160816; b=0VbNOoNugJZ3GkHuXbMp8ljh00FAbh8SW7qqXAMCobkKZvrdIuXAkGWLZOYX/TGhEH dzVUvdwUWBlYTEumobOUk3+eH+SnsgCFGHgyPjc43wN8qF3AToVke8hK0c8+/2Uku1Hx e2ofEwGPHSd43RKnbKlzakPV1ePH9kS6bo4TjwsMnGy69YhjGi8SjMGyxgZ/FqhVvYEt uVK8+JDOgkfM65EP6Aep7qdVk24P5haUUP9YHaHDM8HOplDQQIZlJ4eQHRNQfOIPCOqT stvNYt6x8XvyXPjWHXkIhhbe9ZBwT0TGu8z7uBXMdHFyTE/554U5ADyRjlbW8Le1LCVs +8bw== 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; bh=+wTRkpyHTc8BS0WuAcR23j0uN5DCcAjUjDhW1axvcvI=; b=a1YOrFnWH2KDNCuOg7oTFwSEapALrjlTFUTy3aD3h5aSyN+az0O0f8fG2UEZX0z5my VmtuWVCiyWz312kxi566rP+zeuKEAr6WbFeM/lbDhPPHjGg7LcOSIZtEdDeRvBs6eI5B l4/BCOqyiWqT4sDQeAyemIm6D5o2vWBNFx5v2Nj/Zt85CBPFPo4+CQR1N7YLmXzQ49Bd knNJpv28KeMxLYdlp5zcjLOU+G9UYFd+PtGzWHr8VHrdaMejl8dZKdBglyRV88UN08sk GuhxyukR/YWmcQDJt03s95yARLimUhchE0AqDe/k8Tp575fGMz5UZTqnElMwJgZ+bT8O ygrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ee49-20020a056402293100b00461992160edsi9225459edb.384.2022.11.07.12.44.43; Mon, 07 Nov 2022 12:45:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232944AbiKGU2x (ORCPT + 99 others); Mon, 7 Nov 2022 15:28:53 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748871578860435961?= X-GMAIL-MSGID: =?utf-8?q?1748871578860435961?= 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/r8188eu/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 *adapter, struct recv_frame *precv_frame) { struct sta_info *psta = NULL; - u8 *ptr = precv_frame->rx_data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)precv_frame->rx_data; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; struct security_priv *psecuritypriv = &adapter->securitypriv; @@ -1071,10 +1070,12 @@ static int validate_recv_data_frame(struct adapter *adapter, pattrib->ack_policy = 0; /* parsing QC field */ if (pattrib->qos) { + struct ieee80211_qos_hdr *qos_hdr = (struct ieee80211_qos_hdr *)hdr; + pattrib->priority = ieee80211_get_tid(hdr); - pattrib->ack_policy = GetAckpolicy((ptr + 24)); - pattrib->amsdu = GetAMsdu((ptr + 24)); - pattrib->hdrlen = 26; + pattrib->ack_policy = GetAckpolicy(&qos_hdr->qos_ctrl); + pattrib->amsdu = GetAMsdu(&qos_hdr->qos_ctrl); + pattrib->hdrlen = sizeof(*qos_hdr); if (pattrib->priority != 0 && pattrib->priority != 3) adapter->recvpriv.bIsAnyNonBEPkts = true; From patchwork Mon Nov 7 20:28:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 16672 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2284895wru; Mon, 7 Nov 2022 12:45:32 -0800 (PST) X-Google-Smtp-Source: AMsMyM4xEvKhXLEYSe8Ji7XBmaAy26fOcC3/OlyundDZ9ganpeNCKUOCiuIp5jZkM9ZL53XuxKce X-Received: by 2002:a17:907:7e85:b0:7ad:bf64:b5de with SMTP id qb5-20020a1709077e8500b007adbf64b5demr48429168ejc.20.1667853931808; Mon, 07 Nov 2022 12:45:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667853931; cv=none; d=google.com; s=arc-20160816; b=kEMkAQ4eO4+ogfPqRm4Ljn958YBEM09jL2Cf6uiGqv1AwIkglXoIYEkrIKNOswus3N zQlhzuKyEYRbtN9MVa5QtqqFf1br92BVSekWSEVY+vadn1iUUXjfveviQPztPBCVCCFD QRclwUBRA9zraAsfL2uDdnRX2dPjTacV8IRc25kyZVSeZlf15wSWysJpaeNe6ISk64XT 0MpJR/BY2S5BcQnRKDVWAxUEeGICZ5clqHuWCb6z7rfpwuaAufCOd+Rt+QpY2M0g8mGQ sIWkTAhckxDyfl+/yPnSjVej0Ob8WNtrM1o2m0+5lkHnfSwJ2ACrQ2FISlD6/E684uOg Dfmw== 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; bh=uDyOvkm6/+OKBHgvu7fmcFq3OmFFRwHI49Wxj7re1+o=; b=ssTBlC3IthDp8jyS03hIm7+z1N2Jdfl0u9j+wSKBa58zimuA7G+bJYfRrcfErTf0Po qrqP3vk/gMXt7sj0cSOwrBY7u5JsaglqyybLXHbJYsezX7a/Cc2Dws4LAiYT476CXYV9 OlzgxgEmu6kxFaq4KxHSZrd0TdueViu6NzM1XyPanNVb2XrnUm/eqkF6DjO/5N3jF7ZL mmBE9dKlin+7Wjx28zPvMM5YBp9NjMcDwgKxPMG+z4WnBIvwEtdTlwt9ocDz4Tb29cx+ 1yUJjrMv24LKpRFzD/2eqfWR/f4d/rIgQqp7TEK7QNjjeUZo1byIcmuxNIZt9nO5RBdC JOow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf42-20020a1709077f2a00b007701a050273si11029643ejc.942.2022.11.07.12.45.08; Mon, 07 Nov 2022 12:45:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232971AbiKGU24 (ORCPT + 99 others); Mon, 7 Nov 2022 15:28:56 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748871604250093051?= X-GMAIL-MSGID: =?utf-8?q?1748871604250093051?= 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, struct ndis_802_11_ssid *pssid, i++; - if (padapter->bDriverStopped || padapter->bSurpriseRemoved) - break; - if (i < try_cnt && wait_ms > 0 && ret == _FAIL) msleep(wait_ms); From patchwork Mon Nov 7 20:28:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 16671 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2284757wru; Mon, 7 Nov 2022 12:45:17 -0800 (PST) X-Google-Smtp-Source: AMsMyM4r9gXptK/88GHwzkRq7uVKoAoRMoolIhpOIw8TdRgMA/20Hjrm7kv6ZgeoNz823m9p87f0 X-Received: by 2002:a17:903:22c7:b0:187:190d:da89 with SMTP id y7-20020a17090322c700b00187190dda89mr46597658plg.68.1667853917396; Mon, 07 Nov 2022 12:45:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667853917; cv=none; d=google.com; s=arc-20160816; b=VeQnAEeYcWaoWNZJq1KbMuDeFk3OB9VrIXLD07ITfDPCG78EXRlq2Ge91tjT6gZ1qp DZatkbpUEdewJEOdW7mq1dFl0A7vFOUOjfLOrNayuZyu57CQvfQI8l2byA9k6nK3JTCC 4VRn6M36mDXU1rERKFSVvSZ4QTM6QR131ANOWhQJS5YIIwAj13UExznZviWbgQns0TV6 n/GEd8lCc76IICIZ4RK4qnug92Rw3yPZT8yf74+lZu1dvxRNkITD0OamQXaVnOea0ENo RESctTqeDh3ibZGO80T0bWe8Mu6szpyD3bSCTKBum4vUBspBea3yl4XL8+WgvhhDpWa4 0eaA== 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; bh=xfNxVhybfKl5gi348mpSZ7LIuOrIKyGa9hl7V6e0URI=; b=prebQ8dKQXYCzw3UQUAHPigEG4AXDw3kTUGYXVuQA43r2dV5LWKiDyz4HxRqzNBRb/ JyKHVaRh54a6gMLtTQ2f8qO1jSetD30CeyGfWFRAhJXMmz/STGWkqnhbyfxF1YpMcpv7 fSJTWG78DNCk2WuN1xikrSFPI2z5aFbVYBjuEVg2CHjtmHTGpWkSQebQN2mGjG0rC45P EKKw4An1J2lSDFDan7VXIraztCAmuz1i6f/1gZMFLkAMDfdySsAq8HYKnSMBUWgXZwJa ckWQ5/wMoF9XXQCrylRcEAlcLFM2y7BP2PwCpXTo51cibqtI1rGS76wI8iF73Ca/8Q+M CmkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot12-20020a17090b3b4c00b0020055731860si13190465pjb.105.2022.11.07.12.45.03; Mon, 07 Nov 2022 12:45:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232972AbiKGU2u (ORCPT + 99 others); Mon, 7 Nov 2022 15:28:50 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748871589084844979?= X-GMAIL-MSGID: =?utf-8?q?1748871589084844979?= 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 *padapter, struct xmit_frame *pmg u32 timeout_ms = 500;/* 500ms */ struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - if (padapter->bSurpriseRemoved || padapter->bDriverStopped) - return -1; - mutex_lock(&pxmitpriv->ack_tx_mutex); pxmitpriv->ack_tx = true;