* + ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk.patch added to mm-nonmm-hotfixes-unstable branch
[not found] <20261130-kbug-l1059-ocfs2-quota-v1-1-ea88bd28639b@gmail.com>
@ 2026-12-01 20:20 ` Andrew Morton
2026-12-02 3:51 ` [merged mm-nonmm-hotfixes-stable] ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk.patch removed from -mm tree Andrew Morton
1 sibling, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2026-12-01 20:20 UTC (permalink / raw)
To: mm-commits, stable, mark, joseph.qi, jlbec, jack, heming.zhao,
zzjas98, akpm
The patch titled
Subject: ocfs2: don't free a NULL chunk in ocfs2_local_quota_add_chunk()
has been added to the -mm mm-nonmm-hotfixes-unstable branch. Its filename is
ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk.patch
This patch will later appear in the mm-nonmm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Zijie Zhao <zzjas98@gmail.com>
Subject: ocfs2: don't free a NULL chunk in ocfs2_local_quota_add_chunk()
Date: Mon, 30 Nov 2026 17:56:19 -0600
ocfs2_local_quota_add_chunk() allocates the in-memory chunk only after the
local quota file has been extended. If ocfs2_extend_no_holes() or
ocfs2_simple_size_update() fails, for example with -ENOSPC on a full
filesystem, or if kmem_cache_alloc() fails, the function jumps to the out
label with chunk still NULL. The out label then calls
kmem_cache_free(ocfs2_qf_chunk_cachep, NULL).
Unlike kfree(), kmem_cache_free() does not accept NULL. It calls
virt_to_slab() on the pointer and reads the struct page derived from
address 0. This can oops, or warn about freeing an object that is not
from a slab page.
Allocate the chunk before the file is extended and return right away if
the allocation fails. Every jump to the out label then has a valid chunk
to free. A failed allocation also no longer leaves the local quota file
grown by two unused blocks.
Found by a static analysis tool.
The fix and this changelog were drafted with AI assistance (Claude Code,
with a second review by OpenAI Codex), then reviewed by the submitter.
Link: https://patch.msgid.link/20261130-kbug-l1059-ocfs2-quota-v1-1-ea88bd28639b@gmail.com
Fixes: 9e33d69f553a ("ocfs2: Implementation of local and global quota file handling")
Signed-off-by: Zijie Zhao <zzjas98@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Heming Zhao <heming.zhao@suse.com>
Cc: <stable@vger.kernel.org>
fs/ocfs2/quota_local.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
--- a/fs/ocfs2/quota_local.c~ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk
+++ a/fs/ocfs2/quota_local.c
@@ -1003,6 +1003,13 @@ static struct ocfs2_quota_chunk *ocfs2_l
struct buffer_head *bh = NULL, *dbh = NULL;
u64 p_blkno;
+ chunk = kmem_cache_alloc(ocfs2_qf_chunk_cachep, GFP_NOFS);
+ if (!chunk) {
+ status = -ENOMEM;
+ mlog_errno(status);
+ return ERR_PTR(status);
+ }
+
/* We are protected by dqio_sem so no locking needed */
status = ocfs2_extend_no_holes(lqinode, NULL,
i_size_read(lqinode) + 2 * sb->s_blocksize,
@@ -1018,12 +1025,6 @@ static struct ocfs2_quota_chunk *ocfs2_l
goto out;
}
- chunk = kmem_cache_alloc(ocfs2_qf_chunk_cachep, GFP_NOFS);
- if (!chunk) {
- status = -ENOMEM;
- mlog_errno(status);
- goto out;
- }
/* Local quota info and two new blocks we initialize */
handle = ocfs2_start_trans(OCFS2_SB(sb),
OCFS2_LOCAL_QINFO_WRITE_CREDITS +
_
Patches currently in -mm which might be from zzjas98@gmail.com are
ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
* [merged mm-nonmm-hotfixes-stable] ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk.patch removed from -mm tree
[not found] <20261130-kbug-l1059-ocfs2-quota-v1-1-ea88bd28639b@gmail.com>
2026-12-01 20:20 ` + ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk.patch added to mm-nonmm-hotfixes-unstable branch Andrew Morton
@ 2026-12-02 3:51 ` Andrew Morton
1 sibling, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2026-12-02 3:51 UTC (permalink / raw)
To: mm-commits, stable, mark, joseph.qi, jlbec, jack, heming.zhao,
zzjas98, akpm
The quilt patch titled
Subject: ocfs2: don't free a NULL chunk in ocfs2_local_quota_add_chunk()
has been removed from the -mm tree. Its filename was
ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk.patch
This patch was dropped because it was merged into the mm-nonmm-hotfixes-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Zijie Zhao <zzjas98@gmail.com>
Subject: ocfs2: don't free a NULL chunk in ocfs2_local_quota_add_chunk()
Date: Mon, 30 Nov 2026 17:56:19 -0600
ocfs2_local_quota_add_chunk() allocates the in-memory chunk only after the
local quota file has been extended. If ocfs2_extend_no_holes() or
ocfs2_simple_size_update() fails, for example with -ENOSPC on a full
filesystem, or if kmem_cache_alloc() fails, the function jumps to the out
label with chunk still NULL. The out label then calls
kmem_cache_free(ocfs2_qf_chunk_cachep, NULL).
Unlike kfree(), kmem_cache_free() does not accept NULL. It calls
virt_to_slab() on the pointer and reads the struct page derived from
address 0. This can oops, or warn about freeing an object that is not
from a slab page.
Allocate the chunk before the file is extended and return right away if
the allocation fails. Every jump to the out label then has a valid chunk
to free. A failed allocation also no longer leaves the local quota file
grown by two unused blocks.
Found by a static analysis tool.
The fix and this changelog were drafted with AI assistance (Claude Code,
with a second review by OpenAI Codex), then reviewed by the submitter.
Link: https://patch.msgid.link/20261130-kbug-l1059-ocfs2-quota-v1-1-ea88bd28639b@gmail.com
Fixes: 9e33d69f553a ("ocfs2: Implementation of local and global quota file handling")
Signed-off-by: Zijie Zhao <zzjas98@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Heming Zhao <heming.zhao@suse.com>
Cc: <stable@vger.kernel.org>
fs/ocfs2/quota_local.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
--- a/fs/ocfs2/quota_local.c~ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk
+++ a/fs/ocfs2/quota_local.c
@@ -1003,6 +1003,13 @@ static struct ocfs2_quota_chunk *ocfs2_l
struct buffer_head *bh = NULL, *dbh = NULL;
u64 p_blkno;
+ chunk = kmem_cache_alloc(ocfs2_qf_chunk_cachep, GFP_NOFS);
+ if (!chunk) {
+ status = -ENOMEM;
+ mlog_errno(status);
+ return ERR_PTR(status);
+ }
+
/* We are protected by dqio_sem so no locking needed */
status = ocfs2_extend_no_holes(lqinode, NULL,
i_size_read(lqinode) + 2 * sb->s_blocksize,
@@ -1018,12 +1025,6 @@ static struct ocfs2_quota_chunk *ocfs2_l
goto out;
}
- chunk = kmem_cache_alloc(ocfs2_qf_chunk_cachep, GFP_NOFS);
- if (!chunk) {
- status = -ENOMEM;
- mlog_errno(status);
- goto out;
- }
/* Local quota info and two new blocks we initialize */
handle = ocfs2_start_trans(OCFS2_SB(sb),
OCFS2_LOCAL_QINFO_WRITE_CREDITS +
_
Patches currently in -mm which might be from zzjas98@gmail.com are
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-02 3:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261130-kbug-l1059-ocfs2-quota-v1-1-ea88bd28639b@gmail.com>
2026-12-01 20:20 ` + ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk.patch added to mm-nonmm-hotfixes-unstable branch Andrew Morton
2026-12-02 3:51 ` [merged mm-nonmm-hotfixes-stable] ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk.patch removed from -mm tree Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox