Netdev List
 help / color / mirror / Atom feed
* [PATCH net] sctp: fix addip_serial increment on ASCONF_ACK allocation failure
@ 2026-07-23  7:18 luoqing
  2026-07-29  1:24 ` Jakub Kicinski
  2026-08-04  2:55 ` [PATCH net v2] " luoqing
  0 siblings, 2 replies; 6+ messages in thread
From: luoqing @ 2026-07-23  7:18 UTC (permalink / raw)
  To: marcelo.leitner, lucien.xin
  Cc: davem, edumazet, kuba, pabeni, horms, linux-sctp, netdev

From: Qing Luo <luoqing@kylinos.cn>

In sctp_process_asconf(), when sctp_make_asconf_ack() fails to allocate
the ASCONF_ACK chunk due to memory pressure, the code jumps to the
done label where asoc->peer.addip_serial is unconditionally incremented.

This leaves the peer's ASCONF (serial N) unacknowledged while the local
endpoint now expects serial N+1. When the peer retransmits serial N, it
falls into the serial < addip_serial + 1 branch ,
which attempts to look up a cached ACK for serial N. No cached ACK
exists since the allocation failed, so the retransmission is silently
discarded. The peer eventually times out and ABORTs the association.

Move the addip_serial increment inside the if (asconf_ack) block so that
the serial number is only advanced when the ASCONF_ACK is successfully
created and cached. This way, on allocation failure, the serial number
is unchanged and the peer's retransmitted ASCONF will be correctly
re-processed.

Fixes: 1da177e4c3f4 (Linux-2.6.12-rc2)
Signed-off-by: Qing Luo <luoqing@kylinos.cn>
---
 net/sctp/sm_make_chunk.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 8adac9e0cd66..87b5d320977b 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -3321,12 +3321,11 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
 			goto done;
 	}
 done:
-	asoc->peer.addip_serial++;
-
 	/* If we are sending a new ASCONF_ACK hold a reference to it in assoc
 	 * after freeing the reference to old asconf ack if any.
 	 */
 	if (asconf_ack) {
+		asoc->peer.addip_serial++;
 		sctp_chunk_hold(asconf_ack);
 		list_add_tail(&asconf_ack->transmitted_list,
 			      &asoc->asconf_ack_list);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net] sctp: fix addip_serial increment on ASCONF_ACK allocation failure
  2026-07-23  7:18 [PATCH net] sctp: fix addip_serial increment on ASCONF_ACK allocation failure luoqing
@ 2026-07-29  1:24 ` Jakub Kicinski
  2026-07-29 16:03   ` Xin Long
  2026-08-04  2:55 ` [PATCH net v2] " luoqing
  1 sibling, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2026-07-29  1:24 UTC (permalink / raw)
  To: luoqing
  Cc: marcelo.leitner, lucien.xin, davem, edumazet, pabeni, horms,
	linux-sctp, netdev

On Thu, 23 Jul 2026 15:18:18 +0800 luoqing wrote:
> From: Qing Luo <luoqing@kylinos.cn>
> 
> In sctp_process_asconf(), when sctp_make_asconf_ack() fails to allocate
> the ASCONF_ACK chunk due to memory pressure, the code jumps to the
> done label where asoc->peer.addip_serial is unconditionally incremented.
> 
> This leaves the peer's ASCONF (serial N) unacknowledged while the local
> endpoint now expects serial N+1. When the peer retransmits serial N, it
> falls into the serial < addip_serial + 1 branch ,
> which attempts to look up a cached ACK for serial N. No cached ACK
> exists since the allocation failed, so the retransmission is silently
> discarded. The peer eventually times out and ABORTs the association.
> 
> Move the addip_serial increment inside the if (asconf_ack) block so that
> the serial number is only advanced when the ASCONF_ACK is successfully
> created and cached. This way, on allocation failure, the serial number
> is unchanged and the peer's retransmitted ASCONF will be correctly
> re-processed.
> 
> Fixes: 1da177e4c3f4 (Linux-2.6.12-rc2)

nit: missing quotation marks around the subject
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] sctp: fix addip_serial increment on ASCONF_ACK allocation failure
  2026-07-29  1:24 ` Jakub Kicinski
@ 2026-07-29 16:03   ` Xin Long
  0 siblings, 0 replies; 6+ messages in thread
From: Xin Long @ 2026-07-29 16:03 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: luoqing, marcelo.leitner, davem, edumazet, pabeni, horms,
	linux-sctp, netdev

On Tue, Jul 28, 2026 at 9:24 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 23 Jul 2026 15:18:18 +0800 luoqing wrote:
> > From: Qing Luo <luoqing@kylinos.cn>
> >
> > In sctp_process_asconf(), when sctp_make_asconf_ack() fails to allocate
> > the ASCONF_ACK chunk due to memory pressure, the code jumps to the
> > done label where asoc->peer.addip_serial is unconditionally incremented.
> >
> > This leaves the peer's ASCONF (serial N) unacknowledged while the local
> > endpoint now expects serial N+1. When the peer retransmits serial N, it
> > falls into the serial < addip_serial + 1 branch ,
> > which attempts to look up a cached ACK for serial N. No cached ACK
> > exists since the allocation failed, so the retransmission is silently
> > discarded. The peer eventually times out and ABORTs the association.
> >
> > Move the addip_serial increment inside the if (asconf_ack) block so that
> > the serial number is only advanced when the ASCONF_ACK is successfully
> > created and cached. This way, on allocation failure, the serial number
> > is unchanged and the peer's retransmitted ASCONF will be correctly
> > re-processed.
> >
> > Fixes: 1da177e4c3f4 (Linux-2.6.12-rc2)
>
> nit: missing quotation marks around the subject
> --
> pw-bot: cr

Somehow I missed this patch.

LGTM, except the nit Jakub pointed out.

Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net v2] sctp: fix addip_serial increment on ASCONF_ACK allocation failure
  2026-07-23  7:18 [PATCH net] sctp: fix addip_serial increment on ASCONF_ACK allocation failure luoqing
  2026-07-29  1:24 ` Jakub Kicinski
@ 2026-08-04  2:55 ` luoqing
  2026-08-04 18:31   ` Xin Long
  2026-08-05  3:10   ` patchwork-bot+netdevbpf
  1 sibling, 2 replies; 6+ messages in thread
From: luoqing @ 2026-08-04  2:55 UTC (permalink / raw)
  To: l1138897701
  Cc: davem, edumazet, horms, kuba, linux-sctp, lucien.xin,
	marcelo.leitner, netdev, pabeni

From: Qing Luo <luoqing@kylinos.cn>

In sctp_process_asconf(), when sctp_make_asconf_ack() fails to allocate
the ASCONF_ACK chunk due to memory pressure, the code jumps to the
done label where asoc->peer.addip_serial is unconditionally incremented.

This leaves the peer's ASCONF (serial N) unacknowledged while the local
endpoint now expects serial N+1. When the peer retransmits serial N, it
falls into the serial < addip_serial + 1 branch ,
which attempts to look up a cached ACK for serial N. No cached ACK
exists since the allocation failed, so the retransmission is silently
discarded. The peer eventually times out and ABORTs the association.

Move the addip_serial increment inside the if (asconf_ack) block so that
the serial number is only advanced when the ASCONF_ACK is successfully
created and cached. This way, on allocation failure, the serial number
is unchanged and the peer's retransmitted ASCONF will be correctly
re-processed.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Qing Luo <luoqing@kylinos.cn>
---
 net/sctp/sm_make_chunk.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index c02809264075..30c0da27430e 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -3327,12 +3327,11 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
 			goto done;
 	}
 done:
-	asoc->peer.addip_serial++;
-
 	/* If we are sending a new ASCONF_ACK hold a reference to it in assoc
 	 * after freeing the reference to old asconf ack if any.
 	 */
 	if (asconf_ack) {
+		asoc->peer.addip_serial++;
 		sctp_chunk_hold(asconf_ack);
 		list_add_tail(&asconf_ack->transmitted_list,
 			      &asoc->asconf_ack_list);
-- 
2.25.1
> nit: missing quotation marks around the subject
> LGTM, except the nit Jakub pointed out.
Correct the code formatting


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2] sctp: fix addip_serial increment on ASCONF_ACK allocation failure
  2026-08-04  2:55 ` [PATCH net v2] " luoqing
@ 2026-08-04 18:31   ` Xin Long
  2026-08-05  3:10   ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 6+ messages in thread
From: Xin Long @ 2026-08-04 18:31 UTC (permalink / raw)
  To: luoqing
  Cc: davem, edumazet, horms, kuba, linux-sctp, marcelo.leitner, netdev,
	pabeni

On Mon, Aug 3, 2026 at 10:56 PM luoqing <l1138897701@163.com> wrote:
>
> From: Qing Luo <luoqing@kylinos.cn>
>
> In sctp_process_asconf(), when sctp_make_asconf_ack() fails to allocate
> the ASCONF_ACK chunk due to memory pressure, the code jumps to the
> done label where asoc->peer.addip_serial is unconditionally incremented.
>
> This leaves the peer's ASCONF (serial N) unacknowledged while the local
> endpoint now expects serial N+1. When the peer retransmits serial N, it
> falls into the serial < addip_serial + 1 branch ,
> which attempts to look up a cached ACK for serial N. No cached ACK
> exists since the allocation failed, so the retransmission is silently
> discarded. The peer eventually times out and ABORTs the association.
>
> Move the addip_serial increment inside the if (asconf_ack) block so that
> the serial number is only advanced when the ASCONF_ACK is successfully
> created and cached. This way, on allocation failure, the serial number
> is unchanged and the peer's retransmitted ASCONF will be correctly
> re-processed.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Qing Luo <luoqing@kylinos.cn>

Acked-by: Xin Long <lucien.xin@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2] sctp: fix addip_serial increment on ASCONF_ACK allocation failure
  2026-08-04  2:55 ` [PATCH net v2] " luoqing
  2026-08-04 18:31   ` Xin Long
@ 2026-08-05  3:10   ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-05  3:10 UTC (permalink / raw)
  To: luoqing
  Cc: davem, edumazet, horms, kuba, linux-sctp, lucien.xin,
	marcelo.leitner, netdev, pabeni

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  4 Aug 2026 10:55:14 +0800 you wrote:
> From: Qing Luo <luoqing@kylinos.cn>
> 
> In sctp_process_asconf(), when sctp_make_asconf_ack() fails to allocate
> the ASCONF_ACK chunk due to memory pressure, the code jumps to the
> done label where asoc->peer.addip_serial is unconditionally incremented.
> 
> This leaves the peer's ASCONF (serial N) unacknowledged while the local
> endpoint now expects serial N+1. When the peer retransmits serial N, it
> falls into the serial < addip_serial + 1 branch ,
> which attempts to look up a cached ACK for serial N. No cached ACK
> exists since the allocation failed, so the retransmission is silently
> discarded. The peer eventually times out and ABORTs the association.
> 
> [...]

Here is the summary with links:
  - [net,v2] sctp: fix addip_serial increment on ASCONF_ACK allocation failure
    https://git.kernel.org/netdev/net/c/aa2e13ae8d3c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-05  3:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23  7:18 [PATCH net] sctp: fix addip_serial increment on ASCONF_ACK allocation failure luoqing
2026-07-29  1:24 ` Jakub Kicinski
2026-07-29 16:03   ` Xin Long
2026-08-04  2:55 ` [PATCH net v2] " luoqing
2026-08-04 18:31   ` Xin Long
2026-08-05  3:10   ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox