From: luoqing <l1138897701@163.com>
To: marcelo.leitner@gmail.com, lucien.xin@gmail.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: horms@kernel.org, linux-sctp@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
luoqing@kylinos.cn
Subject: [PATCH 2/2] sctp: auth: Fix safety issue when skb_clone fails in auth_chunk handling
Date: Thu, 16 Jul 2026 14:52:59 +0800 [thread overview]
Message-ID: <20260716065259.872235-2-l1138897701@163.com> (raw)
In-Reply-To: <20260716065259.872235-1-l1138897701@163.com>
From: luoqing <luoqing@kylinos.cn>
When processing AUTH + COOKIE-ECHO packets, if skb_clone fails due to
memory pressure, chunk->auth_chunk is set to NULL but chunk->auth is
still set to 1. This causes sctp_auth_chunk_verify to skip the AUTH
validation (since auth_chunk is NULL), allowing unauthenticated
COOKIE-ECHO packets to be accepted.
Fix this by only setting chunk->auth = 1 when skb_clone succeeds.
Signed-off-by: luoqing <luoqing@kylinos.cn>
---
net/sctp/associola.c | 3 ++-
net/sctp/endpointola.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 62d3cc155809..e54068305396 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -999,7 +999,8 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
if (next_hdr->type == SCTP_CID_COOKIE_ECHO) {
chunk->auth_chunk = skb_clone(chunk->skb,
GFP_ATOMIC);
- chunk->auth = 1;
+ if (chunk->auth_chunk)
+ chunk->auth = 1;
continue;
}
}
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index dfb1719275db..3419748c66bc 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -368,7 +368,8 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work)
if (next_hdr->type == SCTP_CID_COOKIE_ECHO) {
chunk->auth_chunk = skb_clone(chunk->skb,
GFP_ATOMIC);
- chunk->auth = 1;
+ if (chunk->auth_chunk)
+ chunk->auth = 1;
continue;
}
}
--
2.25.1
next prev parent reply other threads:[~2026-07-16 6:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 6:52 [PATCH 1/2] sctp: socket: Fix uninitialized error on socket shutdown luoqing
2026-07-16 6:52 ` luoqing [this message]
2026-07-16 7:42 ` Jagielski, Jedrzej
2026-07-17 8:20 ` [PATCH net v3] sctp: socket: remove unused 'err' parameter from sctp_skb_recv_datagram luoqing
2026-07-17 15:10 ` Xin Long
2026-07-17 18:19 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260716065259.872235-2-l1138897701@163.com \
--to=l1138897701@163.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=luoqing@kylinos.cn \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox