From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Vasiliy Kovalev <kovalev@altlinux.org>, Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 5.15] net: defer final 'struct net' free in netns dismantle
Date: Wed, 15 Jan 2025 19:25:31 -0500 [thread overview]
Message-ID: <20250115160422-e1d7cda0f4f3d04c@stable.kernel.org> (raw)
In-Reply-To: <20250115091642.335047-1-kovalev@altlinux.org>
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: 0f6ede9fbc747e2553612271bce108f7517e7a45
WARNING: Author mismatch between patch and upstream commit:
Backport author: Vasiliy Kovalev<kovalev@altlinux.org>
Commit author: Eric Dumazet<edumazet@google.com>
Status in newer kernel trees:
6.12.y | Present (different SHA1: 6610c7f8a8d4)
6.6.y | Present (different SHA1: b7a79e51297f)
6.1.y | Present (different SHA1: 3267b254dc0a)
5.15.y | Not found
Note: The patch differs from the upstream commit:
---
1: 0f6ede9fbc74 ! 1: bb5ecf836b36 net: defer final 'struct net' free in netns dismantle
@@ Metadata
## Commit message ##
net: defer final 'struct net' free in netns dismantle
+ commit 0f6ede9fbc747e2553612271bce108f7517e7a45 upstream.
+
Ilya reported a slab-use-after-free in dst_destroy [1]
Issue is in xfrm6_net_init() and xfrm4_net_init() :
@@ Commit message
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20241204125455.3871859-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+ Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
## include/net/net_namespace.h ##
@@ include/net/net_namespace.h: struct net {
@@ net/core/net_namespace.c: static struct net *net_alloc(void)
static void net_free(struct net *net)
{
if (refcount_dec_and_test(&net->passive)) {
-@@ net/core/net_namespace.c: static void net_free(struct net *net)
- /* There should not be any trackers left there. */
- ref_tracker_dir_exit(&net->notrefcnt_tracker);
-
+ kfree(rcu_access_pointer(net->gen));
- kmem_cache_free(net_cachep, net);
++
+ /* Wait for an extra rcu_barrier() before final free. */
+ llist_add(&net->defer_free_list, &defer_free_list);
}
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.15.y | Success | Success |
next prev parent reply other threads:[~2025-01-16 0:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 9:16 [PATCH 5.15] net: defer final 'struct net' free in netns dismantle Vasiliy Kovalev
2025-01-16 0:25 ` Sasha Levin [this message]
2025-03-25 3:09 ` jianqi.ren.cn
2025-03-25 3:16 ` Ren, Jianqi (Jacky) (CN)
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=20250115160422-e1d7cda0f4f3d04c@stable.kernel.org \
--to=sashal@kernel.org \
--cc=kovalev@altlinux.org \
--cc=stable@vger.kernel.org \
/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.