From: Sabrina Dubroca <sd@queasysnail.net>
To: clingfei <clf700383@gmail.com>
Cc: horms@kernel.org, davem@davemloft.net, edumazet@google.com,
herbert@gondor.apana.org.au, kuba@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
pabeni@redhat.com, steffen.klassert@secunet.com, eadavis@qq.com,
ssrane_b23@ee.vjti.ac.in,
syzbot+be97dd4da14ae88b6ba4@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com
Subject: Re: [PATCHSET IPSec 0/3] net: key: Fix address family validation and integer overflow in set_ipsecrequest
Date: Thu, 6 Nov 2025 18:07:40 +0100 [thread overview]
Message-ID: <aQzV3KHoF4Kk6DGF@krikkit> (raw)
In-Reply-To: <20251106135658.866481-1-1599101385@qq.com>
2025-11-06, 21:56:55 +0800, clingfei wrote:
> From: Cheng Lingfei <clf700383@gmail.com>
>
> Hi,
>
> This patchset addresses a security issue in the PF_KEYv2 implementation where
> improper address family validation could lead to integer overflows and buffer
> calculation errors in the set_ipsecrequest() function.
>
> The core problem stems from two interrelated issues:
>
> 1. The `family` parameter in set_ipsecrequest() is declared as u8 but receives
> a 16-bit value, causing truncation of the upper byte.
>
> 2. pfkey_sockaddr_len() returns 0 for unsupported address families, but the
> calling code doesn't properly validate this return value before using it in
> size calculations, leading to potential integer overflows.
>
> The patchset is structured as follows:
>
> Patch 1/3: Corrects the type of the family argument from u8 to u16 to prevent
> truncation of 16-bit address family values.
>
> Patch 2/3: Adds proper validation for the return value of pfkey_sockaddr_len()
> to catch unsupported address families early.
>
> Patch 3/3: Enhances the error handling to ensure zero-length allocations are
> properly rejected and adds appropriate error returns.
>
> This series fixes the original issue introduced in:
> Fixes: 14ad6ed30a10 ("net: allow small head cache usage with large MAX_SKB_FRAGS values")
This doesn't seem right. It looks more like a mismatch between the
size computation done before allocating the skb and the space actually
needed, and commit 14ad6ed30a10 made the pre-existing bug more visible.
--
Sabrina
prev parent reply other threads:[~2025-11-06 17:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 13:56 [PATCHSET IPSec 0/3] net: key: Fix address family validation and integer overflow in set_ipsecrequest clingfei
2025-11-06 13:56 ` [PATCH 1/3] fix " clingfei
2025-11-06 13:56 ` [PATCH 2/3] key: No support for family zero clingfei
2025-11-06 13:56 ` [PATCH 3/3] net: key: Validate address family in set_ipsecrequest() clingfei
2025-11-06 14:22 ` [syzbot] [net?] kernel BUG in set_ipsecrequest syzbot
2025-11-06 17:17 ` [PATCH 3/3] net: key: Validate address family in set_ipsecrequest() Sabrina Dubroca
2025-11-07 13:54 ` clingfei
2025-11-06 17:07 ` Sabrina Dubroca [this message]
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=aQzV3KHoF4Kk6DGF@krikkit \
--to=sd@queasysnail.net \
--cc=clf700383@gmail.com \
--cc=davem@davemloft.net \
--cc=eadavis@qq.com \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ssrane_b23@ee.vjti.ac.in \
--cc=steffen.klassert@secunet.com \
--cc=syzbot+be97dd4da14ae88b6ba4@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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;
as well as URLs for NNTP newsgroup(s).