Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2107235pxj; Sat, 19 Jun 2021 03:10:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKfBmXnHyE+aR+jjGmEPKWtjuLb8CnMBJS8S8SYkKCrqyQ999c/xBTYv6wPhluXr1jv4Ex X-Received: by 2002:a6b:7c07:: with SMTP id m7mr7057184iok.177.1624097410017; Sat, 19 Jun 2021 03:10:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624097410; cv=none; d=google.com; s=arc-20160816; b=B9vFPqEpouQ40WlBQcV+XCzR75EkdgRTE45WkU6SL9YrSxP8PAGIhJec71sjmPKSil /2NmCu3dEUuZ2L73oUnELddGt01yxpEWMb6zdUk3cMUJfh3ACjIFidX3AN4EQYH9NGGP yZqEecMuhLANaVda1EynH8oujuiZVBtZjSgdF4vUzs1Yc/IpY8nCwyPyWOGpolZKp2eF AWqM0XG7vkWPqSO0oKTBK09oIHA2u2aCKNImJ8kvJPEfCi6oAJAjNmiqazfxuqV6bpVc uXLELlCHdlpsM1G62SNe1idSsbbknWSh+B6ztfxmNMeqi6dsavu0xGSnLamlerrXm+zh 49IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dmarc-filter:sender:dkim-signature; bh=JExdWib+2vNvSJ1ZeWNdFikcr81uBm3qt2YwfkU3z68=; b=SxKrcfp91s8SxdCzmC6cmqalb3dV01DJhOXBT2MiMrmZCPwypz9YO0+We1ICMM+4Di V8iDLOGD4e+Zr7PFpwtOl7+Po71OnGOqSy4+mDiwnBXP+vE67peS0ZEkvqWmA+lTOUBq JtO+2CKPYj43NnXtTH6LjhsP4xsMaZJRWRBnKKTkkqv63AXo/b7j6LjGcP3OHO6OV1wl lPaa8GyZ74OJnBXydP4GVa4bwbUsUkRrBK2UsUiAOCqyx7oG+EfqVLPj8yc1JTJ1BrsA 229dCF8ZK8RdRLEg38bdcDcXiFvzMdaUQb8NOtQE3KJ2wPfUofKmzI920cpFOf8lxS2e HaLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=pEqqmxqL; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si5259069ilr.155.2021.06.19.03.09.58; Sat, 19 Jun 2021 03:10:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@mg.codeaurora.org header.s=smtp header.b=pEqqmxqL; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230175AbhFSJIg (ORCPT + 99 others); Sat, 19 Jun 2021 05:08:36 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:24731 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbhFSJId (ORCPT ); Sat, 19 Jun 2021 05:08:33 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1624093582; h=Date: Message-Id: Cc: To: References: In-Reply-To: From: Subject: Content-Transfer-Encoding: MIME-Version: Content-Type: Sender; bh=JExdWib+2vNvSJ1ZeWNdFikcr81uBm3qt2YwfkU3z68=; b=pEqqmxqLZXL3KxxzeKAup8xqxjNN/sxwdM6huv0HMddJThfsNh0/QayPS0Q94s8+p4+SX6q8 a5YmMd4ZQi+wmq0xHRbeeu1KNPhiqN912/w6GZbZZcafIzS11bBa4Ynk5nWBAWsnKpm8N5OC xqtPT3Lv1RNNbBQ0+lXYVfz0WOs= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 60cdb38ce570c056194f6450 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 19 Jun 2021 09:06:20 GMT Sender: kvalo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id D786BC43460; Sat, 19 Jun 2021 09:06:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,BAYES_00, MISSING_DATE,MISSING_MID,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from tykki.adurom.net (tynnyri.adurom.net [51.15.11.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9C290C433D3; Sat, 19 Jun 2021 09:06:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9C290C433D3 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=kvalo@codeaurora.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [PATCH] rtl8xxxu: avoid parsing short RX packet From: Kalle Valo In-Reply-To: <20210511071926.8951-1-ihuguet@redhat.com> References: <20210511071926.8951-1-ihuguet@redhat.com> To: =?utf-8?b?w43DsWlnbyBIdWd1ZXQ=?= Cc: Jes.Sorensen@gmail.com, davem@davemloft.net, kuba@kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, ihuguet@redhat.com User-Agent: pwcli/0.1.0-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-Id: <20210619090619.D786BC43460@smtp.codeaurora.org> Date: Sat, 19 Jun 2021 09:06:19 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Íñigo Huguet wrote: > One USB data buffer can contain multiple received network > packets. If that's the case, they're processed this way: > 1. Original buffer is cloned > 2. Original buffer is trimmed to contain only the first > network packet > 3. This first network packet is passed to network stack > 4. Cloned buffer is trimmed to eliminate the first network > packet > 5. Repeat with the cloned buffer until there are no more > network packets inside > > However, if the space remaining in original buffer after > the first network packet is not enough to contain at least > another network packet descriptor, it is not cloned. > > The loop parsing this packets ended if remaining space == 0. > But if the remaining space was > 0 but < packet descriptor > size, another iteration of the loop was done, processing again > the previous packet because cloning didn't happen. Moreover, > the ownership of this packet had been passed to network > stack in the previous iteration. > > This patch ensures that no extra iteration is done if the > remaining size is not enough for one packet, and also avoid > the first iteration for the same reason. > > Probably this doesn't happen in practice, but can happen > theoretically. > > Signed-off-by: Íñigo Huguet Patch applied to wireless-drivers-next.git, thanks. adf6a0f8c0a6 rtl8xxxu: avoid parsing short RX packet -- https://patchwork.kernel.org/project/linux-wireless/patch/20210511071926.8951-1-ihuguet@redhat.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches