]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: af_alg - Cap AEAD AD length to 0x80000000
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 5 May 2026 09:02:45 +0000 (17:02 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 15 May 2026 10:08:37 +0000 (18:08 +0800)
In order to prevent arithmetic overflows when checking the TX
buffer size, cap the associated data length to 0x80000000.

Reported-by: Yiming Qian <yimingqian591@gmail.com>
Fixes: 400c40cf78da ("crypto: algif - add AEAD support")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/af_alg.c

index fce0b87c2b652165cd9902e2ff7e00bc174e9025..48c53f488e0fd30818e72439fe0c0d7e4cee1432 100644 (file)
@@ -584,6 +584,8 @@ static int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con)
                        if (cmsg->cmsg_len < CMSG_LEN(sizeof(u32)))
                                return -EINVAL;
                        con->aead_assoclen = *(u32 *)CMSG_DATA(cmsg);
+                       if (con->aead_assoclen >= 0x80000000u)
+                               return -EINVAL;
                        break;
 
                default: