From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C7A213C67D; Tue, 14 May 2024 11:32:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715686370; cv=none; b=WPklvgppeOM+PrG/rERRbQBNRkvi9nUMaSoPw2TodDVZcJwJhNwkjUrFlJeLOk56uzkOV+eAiPFrS+kfqvOoOLczjohZBO/MGj9MmrozFqA3aOg4447RqV5HGt/3VFmQdOwxX3VfpMG21ynVnnrbBaiLeRGyCzT4CXgat+uRn3w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715686370; c=relaxed/simple; bh=X+YlVgZjrsj3WY2xXDbEEwU6wcZ0sDowMbkV8/GAUIo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pQRSUmPVkAJEWn1bStOoTxM6vLg9lYClyXjDRiGRPaSCt2+PS3TXIGMStf6W+P6woF9Gr09GHkjy5NKetfkc9IeuglSMUbXqZinJ1cOYpMOu2GrRYtY/Rp+VOSsWrnzW+gas36+zJX1TwUisvMY/3V/ulCg6axwXprYPQwjkxM0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SkmLLBvE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="SkmLLBvE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF6E2C2BD10; Tue, 14 May 2024 11:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1715686370; bh=X+YlVgZjrsj3WY2xXDbEEwU6wcZ0sDowMbkV8/GAUIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SkmLLBvEVJ+UxUguA4y8mo1NYu54hK/C0NpKWsV5eOL/rHZE/gQCZLBWBsoQiHA8w Pdhjpe52+3eXYjRTyRmX1yDEuWWeju6piAQNlr+9ZHxWvOJbHvFsVDdksNMuZiw6Gm H3R0WQytPsTg6+BGPthjwDDefNTo37/CgZqc77E8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Richard Gobert , Willem de Bruijn , Paolo Abeni , Sasha Levin Subject: [PATCH 6.1 084/236] net: gro: add flush check in udp_gro_receive_segment Date: Tue, 14 May 2024 12:17:26 +0200 Message-ID: <20240514101023.560232972@linuxfoundation.org> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240514101020.320785513@linuxfoundation.org> References: <20240514101020.320785513@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Richard Gobert [ Upstream commit 5babae777c61aa8a8679d59d3cdc54165ad96d42 ] GRO-GSO path is supposed to be transparent and as such L3 flush checks are relevant to all UDP flows merging in GRO. This patch uses the same logic and code from tcp_gro_receive, terminating merge if flush is non zero. Fixes: e20cf8d3f1f7 ("udp: implement GRO for plain UDP sockets.") Signed-off-by: Richard Gobert Reviewed-by: Willem de Bruijn Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/ipv4/udp_offload.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 84b7d6089f76c..794ea24292f62 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -463,6 +463,7 @@ static struct sk_buff *udp_gro_receive_segment(struct list_head *head, struct sk_buff *p; unsigned int ulen; int ret = 0; + int flush; /* requires non zero csum, for symmetry with GSO */ if (!uh->check) { @@ -496,13 +497,22 @@ static struct sk_buff *udp_gro_receive_segment(struct list_head *head, return p; } + flush = NAPI_GRO_CB(p)->flush; + + if (NAPI_GRO_CB(p)->flush_id != 1 || + NAPI_GRO_CB(p)->count != 1 || + !NAPI_GRO_CB(p)->is_atomic) + flush |= NAPI_GRO_CB(p)->flush_id; + else + NAPI_GRO_CB(p)->is_atomic = false; + /* Terminate the flow on len mismatch or if it grow "too much". * Under small packet flood GRO count could elsewhere grow a lot * leading to excessive truesize values. * On len mismatch merge the first packet shorter than gso_size, * otherwise complete the GRO packet. */ - if (ulen > ntohs(uh2->len)) { + if (ulen > ntohs(uh2->len) || flush) { pp = p; } else { if (NAPI_GRO_CB(skb)->is_flist) { -- 2.43.0