FAILED: patch "[PATCH] espintcp: use sk_msg_free_partial to fix partial send" failed to apply to 5.10-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 007800408002d871f5699bdb944f985896730b8f
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072138-zap-unified-4af3@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 007800408002d871f5699bdb944f985896730b8f Mon Sep 17 00:00:00 2001
From: Sabrina Dubroca <[email protected]>
Date: Fri, 12 Jun 2026 16:11:39 +0200
Subject: [PATCH] espintcp: use sk_msg_free_partial to fix partial send
sk_msg_free_partial() ensures consistency of the skmsg at every iteration, without having to manually handle uncharges and offsets. This simplifies the code, and fixes some bugs in skmsg accounting when we don't send the full contents.
net/xfrm/espintcp.c +7 -27
@@ -212,43 +212,23 @@ static int espintcp_sendskmsg_locked(struct sock *sk,struct sk_msg *skmsg = &emsg->skmsg;bool more = flags &MSG_MORE ;struct scatterlist *sg; -int done =0 ;int ret; - sg = &skmsg->sg.data[skmsg->sg.start];do {struct bio_vec bvec; -size_t size = sg->length - emsg->offset; -int offset = sg->offset + emsg->offset; -struct page *p; - - emsg->offset =0 ; + sg = &skmsg->sg.data[skmsg->sg.start];if (sg_is_last (sg) && !more) msghdr.msg_flags &= ~MSG_MORE ; - p =sg_page (sg); -retry: -bvec_set_page (&bvec, p, size, offset); -iov_iter_bvec (&msghdr.msg_iter,ITER_SOURCE , &bvec,1 , size); - ret =tcp_sendmsg_locked (sk, &msghdr, size); -if (ret <0 ) { - emsg->offset = offset - sg->offset; - skmsg->sg.start += done; +bvec_set_page (&bvec,sg_page (sg), sg->length, sg->offset); +iov_iter_bvec (&msghdr.msg_iter,ITER_SOURCE , &bvec,1 , sg->length); + ret =tcp_sendmsg_locked (sk, &msghdr, sg->length); +if (ret <0 )return ret; - } -if (ret != size) { - offset += ret; - size -= ret; - goto retry; - } - - done++; -put_page (p); -sk_mem_uncharge (sk, sg->length); - sg =sg_next (sg); - }while (sg); +sk_msg_free_partial (sk, skmsg, ret); + }while (skmsg->sg.size);memset (emsg,0 ,sizeof (*emsg));
Sasha Levin
maintainerPATCH 1/1 espintcp: use sk_msg_free_partial to fix partial send
From: Sabrina Dubroca <[email protected]>
[ Upstream commit 007800408002d871f5699bdb944f985896730b8f ]
sk_msg_free_partial() ensures consistency of the skmsg at every iteration, without having to manually handle uncharges and offsets. This simplifies the code, and fixes some bugs in skmsg accounting when we don't send the full contents.
--- net/xfrm/espintcp.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-)
net/xfrm/espintcp.c +6 -26
@@ -208,41 +208,21 @@ static int espintcp_sendskmsg_locked(struct sock *sk, {struct sk_msg *skmsg = &emsg->skmsg;struct scatterlist *sg; -int done =0 ;int ret; flags |=MSG_SENDPAGE_NOTLAST ; - sg = &skmsg->sg.data[skmsg->sg.start];do { -size_t size = sg->length - emsg->offset; -int offset = sg->offset + emsg->offset; -struct page *p; - - emsg->offset =0 ; - + sg = &skmsg->sg.data[skmsg->sg.start];if (sg_is_last (sg)) flags &= ~MSG_SENDPAGE_NOTLAST ; - p =sg_page (sg); -retry: - ret =do_tcp_sendpages (sk, p, offset, size, flags); -if (ret <0 ) { - emsg->offset = offset - sg->offset; - skmsg->sg.start += done; + ret =do_tcp_sendpages (sk,sg_page (sg), sg->offset, + sg->length, flags); +if (ret <0 )return ret; - } - -if (ret != size) { - offset += ret; - size -= ret; - goto retry; - } - done++; -put_page (p); -sk_mem_uncharge (sk, sg->length); - sg =sg_next (sg); - }while (sg); +sk_msg_free_partial (sk, skmsg, ret); + }while (skmsg->sg.size);memset (emsg,0 ,sizeof (*emsg));
Signature · 1 line
2.53.0