From: Andrew Morton <akpm@linux-foundation.org>
To: Kairui Song <ryncsn@gmail.com>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>,
chrisl@kernel.org, kasong@tencent.com, nphamcs@gmail.com,
baoquan.he@linux.dev, youngjun.park@lge.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/4] mm, swap: Fix potential NULL dereference when trying a sleep table allocation
Date: Fri, 28 Aug 2026 18:03:38 -0700 [thread overview]
Message-ID: <20260828180338.0e62379137b832bd66d48b7d@linux-foundation.org> (raw)
In-Reply-To: <ao_ybL9yRO_pHphW@KASONG-MC4>
On Thu, 27 Aug 2026 17:10:54 +0800 Kairui Song <ryncsn@gmail.com> wrote:
> > --- a/mm/swapfile.c
> > +++ b/mm/swapfile.c
> > @@ -466,8 +466,6 @@ static int swap_cluster_alloc_table(struct swap_cluster_info *ci, gfp_t gfp)
> > if (!table)
> > return -ENOMEM;
> >
> > - rcu_assign_pointer(ci->table, table);
> > -
> > #ifdef CONFIG_MEMCG
> > if (!mem_cgroup_disabled()) {
> > VM_WARN_ON_ONCE(ci->memcg_table);
> > @@ -487,6 +485,12 @@ static int swap_cluster_alloc_table(struct swap_cluster_info *ci, gfp_t gfp)
> > return -ENOMEM;
> > }
> > #endif
> > +
> > + /*
> > + * Make tables visible to cluster_is_usable() after everything is
> > + * ready.
> > + */
> > + rcu_assign_pointer(ci->table, table);
>
> Hmm, but for the error paths above, they will leak the new allocated table?
Sashiko thinks so ;)
It also might have found a pre-existing data-race which seems
sufficiently on-topic for this patchset?
https://sashiko.dev/#/patchset/20260820115505.20027-1-shikemeng@huaweicloud.com
next prev parent reply other threads:[~2026-08-29 1:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 11:55 [PATCH v2 0/4] mm, swap: some random fixes and cleanups Kemeng Shi
2026-08-20 11:55 ` [PATCH v2 1/4] mm, swap: Fix potential NULL dereference when trying a sleep table allocation Kemeng Shi
2026-08-27 9:10 ` Kairui Song
2026-08-29 1:03 ` Andrew Morton [this message]
2026-09-05 4:03 ` Kemeng Shi
2026-08-20 11:55 ` [PATCH v2 2/4] mm, swap: Move setup_swap_clusters_info() after SWP_SOLIDSTATE initialization Kemeng Shi
2026-08-27 9:43 ` Kairui Song
2026-08-20 11:55 ` [PATCH v2 3/4] mm, swap: return early from swap_extend_table_try_free() on first non-zero entry Kemeng Shi
2026-08-27 13:54 ` Kairui Song
2026-08-20 11:55 ` [PATCH v2 4/4] mm, swap: Remove unneeded swap_extend_table_try_free() in swap_dup_entries_cluster() Kemeng Shi
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=20260828180338.0e62379137b832bd66d48b7d@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=baoquan.he@linux.dev \
--cc=chrisl@kernel.org \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=ryncsn@gmail.com \
--cc=shikemeng@huaweicloud.com \
--cc=youngjun.park@lge.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.