From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.zx2c4.com (lists.zx2c4.com [165.227.139.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F306C606A68D for ; Fri, 27 Nov 2026 10:01:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=N8qGQGXv Received: by lists.zx2c4.com (OpenSMTPD) with ESMTP id 87519338; Fri, 27 Nov 2026 09:59:50 +0000 (UTC) Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [2a00:1450:4864:20::62a]) by lists.zx2c4.com (OpenSMTPD) with ESMTPS id d0626881 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 27 Nov 2026 09:59:47 +0000 (UTC) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-c513a854320so387925766b.0 for ; Fri, 27 Nov 2026 01:59:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795773587; x=1796378387; darn=lists.zx2c4.com; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=0nK6oALc+naSloQwr+O6Q/o/NLhG5dNIKnSetmOiKA0=; b=N8qGQGXvpcFNr6Wx6kzoZSQ2qFUKlcS8oGZjsM2UaUHP8qVT1V+2PrC4fEAdZDwbRS 6oc6k3EB6iKp8vW2UzTdrxP5yGSizWqzG46ha54WGoorbbgZIBFPxoia+d4Pt+/DB9UB pCpqWKe6UKd7dnQX+frzUKsMBlXcj9A+h9K/QjHzftOy1Xo2vg4De50W9XEQDLm7F0Ca rkyFoZ3YGtwSl4Oq3d41ie/c8x7MwIw9tg07q0YpGafrgAtU5IeLOANuJIQSe1R+nhoB 7ptzaGjeYgNQrwdPX2gS4/n15ijjeoi4h22VX7luNaQKgqcnPsGi1bn8jWuWorXnBpDD zJAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795773587; x=1796378387; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=0nK6oALc+naSloQwr+O6Q/o/NLhG5dNIKnSetmOiKA0=; b=cd1QbDgAnfnjST7CPpjtyPrBAPHJtPGaxKH+B+82KPh8weRy7SWxd4SXGqy1E4XnNe h2CPTmXJ0nF9TrX33wJGs7rRx1o3V7og33STOKpZKQIvDhdHLunqnYC7vTguLkrextJT FfbfjQEH9L4StgY/YnVcxDn+7SH24TdRAjY5Eqp10XrBULdg5YbTeY64m73ZogrbywlQ BUXS+hXLuAPpcRXFWb7Eul0WM+zda7MjRDOc7JeqwvM/JyXAquahMQy3WfSqr4aB7kqe 0KyQCtrgZFL/a1SbjriiiA1pOhSuuEqqxIQo6K0wySuFmexfhvOioIMSLNNEo8jbZ+DZ 4E7Q== X-Gm-Message-State: APuU4Z9BSw2vKgNf001NUHcfa7nLiYoAE4NVcS+hKpkfkjentyiBS9ff FGn96t+YKrdNY8TLcYucjQBvVF2//pPyKZb7v/8DKHTAatWm22m1iF/a X-Gm-Gg: AZFdTZdqkmUBHZsx2raOi4WbJvhGfYlVLSeYJdPo7p+2kVyq1DFPCY6WhH3iQtQsVBg TX0Nf1iPnLxwnWiJt7L1/1OEhp1L8nHpk7nrD87k0+oAl+9tIk2ZScPGSpIx4O/7CdNs7J2KgBf ldnuxGebgVlMt8H1i6pjBTU9lo2kQhEhh5Mvg1JcfSoWdNvXOmt7T9e0YKXU0111VZM4ZmFHBPy PJW4aTiaHOzeQmm0a2aJlD1utHOmAhI2g8dIv9ymmk70FqDsMcENkAmqVcrnteLqk5wA5gyt4tS FVjhMrrPq/+Rqq0DRZfDYhKDs/2ac20KB+3WoBnReYDVhkBtcvG+fz5o0j4BqlH9xFN5y1DXQoc rO/WBvGpsT/gPiRfQcNCBPAp9pOxsoBTz5RC/+HzzAX5t7fl48r+1AdmCRKMYzNNwbuJUmwnNSQ KTwVu9UuVo51/7wez9vaCu0GPq25G5vgmcp/s/JElgIKE/GfqQtIeu1Dmh3HmBzzqsa9skMTxEj b8Fscyq14tS315useh3zDc+dRfRkHgOgdz7QOmAroEf3x2ChNNPw7RFF/Pj4w2hntHKA4sDGfRY 65Evvtu34e7agVOSIpPZ0odRkIfb7N7EQxzEXpTpF0O7Rr4N X-Received: by 2002:a17:906:7944:b0:c41:8e21:4d58 with SMTP id a640c23a62f3a-c513a41edc0mr2010416766b.5.1795773587030; Fri, 27 Nov 2026 01:59:47 -0800 (PST) Received: from Air-pasichndev ([188.163.8.107]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae8ce16sm841249266b.37.2026.11.27.01.59.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 27 Nov 2026 01:59:46 -0800 (PST) From: Andrii Pasichnyk To: "Jason A . Donenfeld" Cc: wireguard@lists.zx2c4.com, netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net v2 1/2] wireguard: peer: free packets left on the per-peer queues on removal Date: Fri, 27 Nov 2026 11:59:43 +0200 Message-ID: <20261127095944.17844-1-apasichnik9@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <179577288773.3135.10772290029017294104@kernel.org> References: <20261126094722.73025-2-apasichnik9@gmail.com> <179577288773.3135.10772290029017294104@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: wireguard@lists.zx2c4.com X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: Development discussion of WireGuard List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "WireGuard" X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Sashiko AI review wrote: > [Severity: High] > Can this purge of peer->tx_queue run while peer->transmit_packet_work is > still pending or running on packet_crypt_wq? Yes, it can. An encrypt worker that the second flush waits for can queue transmit_packet_work after that flush has started, and then nothing waits for it. Before this patch that was harmless, because the entries on tx_queue keep the peer alive until the worker has consumed them. The purge breaks that. > Would a flush_work() or cancel_work_sync() on &peer->transmit_packet_work > before purging tx_queue close this window? It would, but the tx_queue purge is not needed at all. The leak I reproduced is on rx_queue only: the transmit worker has no budget and drains everything that is ready. So v3 will drop the tx_queue purge and free only what the disabled NAPI left on rx_queue. As far as I can see rx_queue does not have the same window: a decrypt worker queues no further work when it is done, it only schedules the NAPI, and napi_disable() waits for the poll. > [Severity: Low] > That makes the new comment the accurate one. Should the old comment be > updated to match? Yes. v3 updates it and says why tx_queue is left alone. Thanks, Andrii pw-bot: cr