From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796183464; b=Zdo6IZKf2UFjVDdV8sUhsaSYV+ELAKDzSnAeM4BwvBd4cdXxItiQrr56wDfasLXFIkLL M1PAr9Svw/dWTkI62NftdzOwqxNaQhBh4C9jdTGSzBmxvY8Vf4uuLc0eUi2QOJMHki8vu qjLwLil8/dQTyRgoEsLKpVt48yY6uvUe0aWisIEKGS/7Y6/l1U0ZSOC/7GHiz3Onfgcgb /O0i6QAFdwfoPj+3O4V/P4cXold6MgfjyX4gX8ABpInMq5lEUavPJ98cN5ez1SPkupSUK 8377LPgpHLkDvkDuye1ko7pOqEfh4+oBZaSDeDtDYgNa5v52WxLyScUybSvfmXXJu5Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796183464; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=zXARlIofiDYxdZbKZk1weGPI4xh7eEObw9I6p6E3LEE=; b=ydDUvqARvseBmQBX9CZ/TEe9SeofYKr3f6x8ga+X8tOFJiTT8b5VawulLS167rVJnwYH sQvTKTYmWpMqibHe2fwY4eBpFp818XyJ2d9++ZjO5bAZP9yYbY0Sf2uedYpPB3vM78kND UOqNPs64bluPiKUwDsZMEzoD8+x/Zsptde1HL438OuxuS/7nct+4W++zN5+YW4ZX0Nx0M hePrvpvOtyVu3l/6IGznyZIHPzIXNshlAf43So7SLjDRzoH/Dwjfzkzz9ezPuuQeYf35Q O1Nx01DzGIj9RXdOJUJ+kxABGoVPmwlrjDe2U7uJVuUmPorzCLHb9oCDdWP/aUG/A3Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=FZMKm2M1; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D3B4606A322; Wed, 2 Dec 2026 03:51:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=FZMKm2M1 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CBFB1F00893; Wed, 2 Dec 2026 03:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796183463; bh=zXARlIofiDYxdZbKZk1weGPI4xh7eEObw9I6p6E3LEE=; h=Date:To:From:In-Reply-To:References:Subject; b=FZMKm2M1z2vPkN14Teq8OVLBRcgGRhAzmstlhUiOiAwHiyJNAUs30xgr2+ivdI27w cvEuuXWQ183lm4yNLC2TJLtwirK64KFIur/iq8SFMTPIV/0eztCnTqMjsV9GFVXqfG Qb7Oyfx57hI7qeBqU5vlTsySIxvCJEl75fQ3Vv04= Date: Tue, 01 Dec 2026 19:51:03 -0800 To: mm-commits@vger.kernel.org,stable@vger.kernel.org,mark@fasheh.com, joseph.qi@linux.alibaba.com,jlbec@evilplan.org,jack@suse.cz, heming.zhao@suse.com,zzjas98@gmail.com,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261130-kbug-l1059-ocfs2-quota-v1-1-ea88bd28639b@gmail.com> References: <20261130-kbug-l1059-ocfs2-quota-v1-1-ea88bd28639b@gmail.com> Subject: [merged mm-nonmm-hotfixes-stable] ocfs2-dont-free-a-null-chunk-in-ocfs2_local_quota_add_chunk.patch removed from -mm tree Message-Id: <20261202035103.8CBFB1F00893@smtp.kernel.org> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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 Signed-off-by: Andrew Morton Reviewed-by: Joseph Qi Reviewed-by: Jan Kara Cc: Mark Fasheh Cc: Joel Becker Cc: Heming Zhao Cc: 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