All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+be97dd4da14ae88b6ba4@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] Fix integer overflow in set_ipsecrequest()
Date: Mon, 20 Oct 2025 00:30:57 -0700	[thread overview]
Message-ID: <68f5e531.a70a0220.205af.002a.GAE@google.com> (raw)
In-Reply-To: <68f1d9d6.050a0220.91a22.0419.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] Fix integer overflow in set_ipsecrequest()
Author: clf700383@gmail.com

Hi syzbot,

Please test the following patch.

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master

Thanks.

From db24f0985600db1f88d5d2b7420f0707d67ea05a Mon Sep 17 00:00:00 2001
From: clingfei <clf700383@gmail.com>
Date: Mon, 20 Oct 2025 13:48:54 +0800
Subject: [PATCH] fix integer overflow in set_ipsecrequest()

syzbot reported a kernel BUG in set_ipsecrequest() due to an skb_over_panic.

The mp->new_family and mp->old_family is u16, while set_ipsecrequest receives
family as uint8_t,  causing a integer overflow and the later size_req calculation 
error, which exceeds the size used in alloc_skb, and ultimately triggered the
kernel bug in skb_put.

Reported-by: syzbot+be97dd4da14ae88b6ba4@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=be97dd4da14ae88b6ba4
Signed-off-by: Cheng Lingfei <clf700383@gmail.com>
---
 net/key/af_key.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/key/af_key.c b/net/key/af_key.c
index 2ebde0352245..08f4cde01994 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3518,7 +3518,7 @@ static int set_sadb_kmaddress(struct sk_buff *skb, const struct xfrm_kmaddress *

 static int set_ipsecrequest(struct sk_buff *skb,
                            uint8_t proto, uint8_t mode, int level,
-                           uint32_t reqid, uint8_t family,
+                           uint32_t reqid, uint16_t family,
                            const xfrm_address_t *src, const xfrm_address_t *dst)
 {
        struct sadb_x_ipsecrequest *rq;
--
2.34.1

  parent reply	other threads:[~2025-10-20  7:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17  5:53 [syzbot] [net?] kernel BUG in set_ipsecrequest syzbot
2025-10-17 10:53 ` syzbot
2025-10-19  2:34 ` [PATCH] key: No support for family zero Edward Adam Davis
2025-10-27 21:00   ` Simon Horman
2025-10-19 18:29 ` [syzbot] [net?] kernel BUG in set_ipsecrequest shaurya
2025-10-19 18:32   ` syzbot
2025-10-20  2:57 ` Forwarded: [Testing] net: key: Validate address family in set_ipsecrequest() syzbot
2025-10-20  7:30 ` syzbot [this message]
2025-10-20  7:54 ` Forwarded: Re: [syzbot] [net?] kernel BUG in set_ipsecrequest syzbot
2025-10-20 11:19 ` Forwarded: syzbot
2025-10-21  3:00 ` [PATCH] fix integer overflow in set_ipsecrequest clingfei
2025-10-23 12:24 ` [PATCH net] net: key: Fix potential " clingfei
2025-10-27 20:37   ` Simon Horman

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=68f5e531.a70a0220.205af.002a.GAE@google.com \
    --to=syzbot+be97dd4da14ae88b6ba4@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.