From nobody Sat Jul 25 22:33:05 2026 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A0132750FB for ; Mon, 13 Jul 2026 03:21:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783912863; cv=none; b=abEn8Fw4jxgQwm8VXsQ9vucAjzcQjCB3ldbohZTccaQ1FrUAfI3g1/PF98hci7xjQTWyUN//bc8DZzQhmQ793eSNLg/NcMTg4bb9B3N876qMVoNvCdeXecKZGt+WHt3N9UYYf2Edn5n1Gq+MxG1wZ4hqJ5rkUAg7rX9BY9rLvXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783912863; c=relaxed/simple; bh=f8TyvXbU4/9gqzHna/fpREB0Ol/K3yg8kGjQFZzlx1o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=sO8YLvYFU1/LPSeWZPTRG4likTwDF+etieVRS+rOp5okqdL1JJ4fSvIvhcScmeuB86UlOX7/vQ1G2R8i88Y9sPCr1LDztyD1iUI+N2ZeRCM8E72EDm6lDba9sovrR7JTO68mdXLVptrF9/75LbtnuuqHBj1Ohu0vlhDcuPrtses= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BPKeyWx4; arc=none smtp.client-ip=209.85.215.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BPKeyWx4" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-ca957338f14so264835a12.1 for ; Sun, 12 Jul 2026 20:21:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783912861; x=1784517661; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=sWliwWscFUVTwPHBU98Th8Nx6ddb6pv8WQCFUGLmIX8=; b=BPKeyWx49TQajrIm4I5i8x6B7s/eVnLpMeeH6lgKphoDdE2258HsnUDkHnZxEYwmEy joGFrkIMUc8RogyXRsWBS4eLQ3pfnZKe1g7aNo3ei38/ngu+BZD5KgXFVdyvA6WX9f8Y 1HX6oot/m9eib/2xNFcSQBQ2NsWFMn16LsXNevjZSeiQyCglXc/b4L3TLBRLXffxDaiX TN3dfn9uAckyBXwF+pqeIUOj3n0N3KnMCV0RLyGEk3rDtmhxwRtLkYP1nGVgYBW2mbu1 YjQdOKI3tGnXOb/wi561kj6be8TZEdKewUZPCgH3sTpI0UnRty6zgItJT4WpC+/Phg4z +3Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783912861; x=1784517661; h=content-transfer-encoding:mime-version: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=sWliwWscFUVTwPHBU98Th8Nx6ddb6pv8WQCFUGLmIX8=; b=nF1pU+vPPKNKQFp5TpSt0DQBZ+CUle5dm2rpKM6NsMWlIwzE51OJpP+9GXwau6TGB5 wfBRQZCMMv4Vf8K7bbTxJGmt4lCnz4dcgtcfi4PX5OBsi1TTzTLXQu4pgsoUkT8+6+xE Xz2IOYf3Xxrsal4U9UIGm7XJBsckDPi1dAYhH2zlG5We9TAOw4yaDqkd1vp/vMtxoH6S rYo/k46kIfcaNS2V86wxrCbOUYukRlN7NIHXfDcNAzOJwc5GS2yGgMXOh3q+zpahzBjO o2rmz3Y6dvOnq2Vp5QO2ZiT0XaFm6mYbiHkIc+PIeyFUvqAZyD1lNtWnsCXjqsXZX3ex WdLg== X-Forwarded-Encrypted: i=1; AHgh+Rqaf79V0Ov35S8RhB3DiS6MlT3Ukqb5Pfh53zACXQZGg4iuTvvSaln1DSaey7YHbbZfIUEf8KJ2ZtjWaEs=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1DLCR3SIAjUlOfheuWOthqaACPzcFa2Ns0tnwNczAbc2btrkT wpZKNMQQvkfZh7RtgIcbVtmhI5BdZ85pKqtV8k5OVFn/QpUAqUR0L44c X-Gm-Gg: AfdE7cl4ZlNjBOdGut/AJl71wQbb7izIfL3RPDIGV3Ib2pShqpj6x9H+jHoQadgm8T+ B0Rx3N3xw/LKfYRzLNcIjicYLyY5sTrL6LtKASLVaIZ3KWL8xVSxTedyOLppsj/CpUg1ooYgGUC le+t+GDRzNoHI9UCAWLbIiqcgdflmpalEGfGZHGe5s9XMYcAaLcTJX/+oGEgXBvqKakepg2bnVr rR9YPmBITDPu4BD+/keIBa2xgKQaXOn2YIRm5GmVj2r8xAPi9mgAfplm41zpTQg65bzeMQ3a3OT a+U06e29PAHk6fjAiyGZ0RQroe6Yd91NbMQzNWvHM2q4Jr0uq3Yj+p26dAa4zVeo/vYHNjZ7UbB xnDUdWXWeNc+t3cSBQNBlCNj99U+HLQNnABkSIPhSWtvhUy73FUnLJs70kkWl94AHshkoLp8eJ/ /dWC+o6YnsM/Hxj3Fl3SPoxUPzQ1txmnEbCUu7D+SPOlerHWHlgAp+lV3Sh0TAhG3L3nnkHswhJ 08I+LKyc/5XODInQyM= X-Received: by 2002:a05:6a00:1884:b0:848:2fbb:de48 with SMTP id d2e1a72fcca58-848897ec5b6mr4901302b3a.6.1783912860749; Sun, 12 Jul 2026 20:21:00 -0700 (PDT) Received: from localhost.localdomain ([47.246.98.82]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-848593a591asm5689195b3a.26.2026.07.12.20.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2026 20:21:00 -0700 (PDT) From: "=?UTF-8?q?=E5=AF=92=E6=B3=89?=" X-Google-Original-From: =?UTF-8?q?=E5=AF=92=E6=B3=89?= To: marcelo.leitner@gmail.com, lucien.xin@gmail.com Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, linux-sctp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, HanQuan Subject: [PATCH v2] sctp: fix auth_chunk_list capacity check in sctp_auth_ep_add_chunkid Date: Mon, 13 Jul 2026 03:20:21 +0000 Message-ID: <20260713032021.3491702-1-zhoujian.zja@antgroup.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: HanQuan sctp_auth_ep_add_chunkid() uses SCTP_NUM_CHUNK_TYPES (20) as the capacity limit for ep->auth_chunk_list, allowing it to hold up to 20 chunk entries (param_hdr.length up to 24). However, the copy destination asoc->c.auth_chunks in struct sctp_cookie is only SCTP_AUTH_MAX_CHUNKS (16) entries (20 bytes). When more than 16 chunks are added, sctp_association_init() memcpy overflows the destination by up to 4 bytes. Fix by using SCTP_AUTH_MAX_CHUNKS as the capacity limit, matching the destination capacity. Fixes: 1f485649f529 ("[SCTP]: Implement SCTP-AUTH internals") Signed-off-by: HanQuan Acked-by: Xin Long --- net/sctp/auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sctp/auth.c b/net/sctp/auth.c index be9782760f50..c901d373af80 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -672,7 +672,7 @@ int sctp_auth_ep_add_chunkid(struct sctp_endpoint *ep, = __u8 chunk_id) /* Check if we can add this chunk to the array */ param_len =3D ntohs(p->param_hdr.length); nchunks =3D param_len - sizeof(struct sctp_paramhdr); - if (nchunks =3D=3D SCTP_NUM_CHUNK_TYPES) + if (nchunks =3D=3D SCTP_AUTH_MAX_CHUNKS) return -EINVAL; =20 p->chunks[nchunks] =3D chunk_id; --=20 2.43.0