From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDE6AC2B9F4 for ; Sat, 19 Jun 2021 09:06:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB2946112D for ; Sat, 19 Jun 2021 09:06:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230175AbhFSJIg (ORCPT ); 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) 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