mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+a25ee9d20d31e483ba7b@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [net?] KASAN: slab-use-after-free Write in __xfrm_state_delete
Date: Wed, 27 Aug 2025 17:35:09 +0800	[thread overview]
Message-ID: <tencent_85C67489962ECA2EE44C9D67DE46C912F006@qq.com> (raw)
In-Reply-To: <68ab6633.050a0220.37038e.0079.GAE@google.com>

#syz test

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index f3014e4f54fc..a1d5acd1f2ad 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -229,6 +229,7 @@ struct xfrm_state {
 		int		trailer_len;
 		u32		extra_flags;
 		struct xfrm_mark	smark;
+		u8		alive;
 	} props;
 
 	struct xfrm_lifetime_cfg lft;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 78fcbb89cf32..d66adf7ee6a2 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -755,6 +755,7 @@ struct xfrm_state *xfrm_state_alloc(struct net *net)
 		x->pcpu_num = UINT_MAX;
 		spin_lock_init(&x->lock);
 		x->mode_data = NULL;
+		x->props.alive = 1;
 	}
 	return x;
 }
@@ -830,6 +831,7 @@ int __xfrm_state_delete(struct xfrm_state *x)
 			hlist_del_rcu(&x->byspi);
 		net->xfrm.state_num--;
 		xfrm_nat_keepalive_state_updated(x);
+		x->props.alive = 0;
 		spin_unlock(&net->xfrm.xfrm_state_lock);
 
 		xfrm_dev_state_delete(x);
@@ -932,7 +934,8 @@ int xfrm_state_flush(struct net *net, u8 proto, bool task_valid)
 restart:
 		hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) {
 			if (!xfrm_state_kern(x) &&
-			    xfrm_id_proto_match(x->id.proto, proto)) {
+			    xfrm_id_proto_match(x->id.proto, proto) &&
+			    x->props.alive) {
 				xfrm_state_hold(x);
 				spin_unlock_bh(&net->xfrm.xfrm_state_lock);
 


  parent reply	other threads:[~2025-08-27  9:40 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29  7:08 syzbot
2025-08-24 19:21 ` syzbot
2025-08-25  1:10   ` Hillf Danton
2025-08-25  1:51     ` syzbot
2025-08-25  4:51   ` Hillf Danton
2025-08-25 12:33     ` syzbot
2025-08-25 12:44   ` Hillf Danton
2025-08-25 14:13     ` syzbot
2025-08-25 15:59   ` Sabrina Dubroca
2025-08-26  3:27   ` Hillf Danton
2025-08-26  3:53     ` syzbot
2025-08-26  4:16   ` Hillf Danton
2025-08-26  5:12     ` syzbot
2025-08-26  7:31   ` Hillf Danton
2025-08-26 11:11     ` syzbot
2025-08-26  9:41   ` Edward Adam Davis
2025-08-26 11:34     ` syzbot
2025-08-26 13:22   ` Hillf Danton
2025-08-26 19:54     ` syzbot
2025-08-27  0:40   ` Hillf Danton
2025-08-27  2:44     ` syzbot
2025-08-27  1:30   ` Edward Adam Davis
2025-08-27  3:03     ` syzbot
2025-08-27  4:51   ` Hillf Danton
2025-08-27  6:27     ` syzbot
2025-08-27  5:18   ` Hillf Danton
2025-08-27  6:44     ` syzbot
2025-08-27  5:49   ` Edward Adam Davis
2025-08-27  6:44     ` syzbot
2025-08-27  6:56   ` Edward Adam Davis
2025-08-27  7:26     ` syzbot
2025-08-27  7:57   ` Hillf Danton
2025-08-27  8:22     ` syzbot
2025-08-27  8:10   ` Edward Adam Davis
2025-08-27  9:14     ` syzbot
2025-08-27  8:39   ` Hillf Danton
2025-08-27  9:31     ` syzbot
2025-08-27  9:35   ` Edward Adam Davis [this message]
2025-08-27 10:23     ` syzbot
2025-08-27 10:07   ` Hillf Danton
2025-08-27 10:41     ` syzbot
2025-08-27 11:00   ` Hillf Danton
2025-08-27 11:48     ` syzbot
2025-08-28  7:25 ` syzbot

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=tencent_85C67489962ECA2EE44C9D67DE46C912F006@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+a25ee9d20d31e483ba7b@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

all inboxes | Powered by JetHome®