From: <gregkh@linuxfoundation.org>
To: gregkh@linuxfoundation.org,harshit.m.mogalapalli@oracle.com,patches@lists.linux.dev,yun.zhou@windriver.com
Cc: <stable-commits@vger.kernel.org>
Subject: Patch "ext4: fix fd leak in EXT4_IOC_MOVE_EXT cross-sb validation" has been added to the 6.12-stable tree
Date: Sat, 25 Jul 2026 08:02:03 +0200 [thread overview]
Message-ID: <2026072503-jab-tabby-8f6d@gregkh> (raw)
In-Reply-To: <20260725024029.1217577-1-yun.zhou@windriver.com>
This is a note to let you know that I've just added the patch titled
ext4: fix fd leak in EXT4_IOC_MOVE_EXT cross-sb validation
to the 6.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ext4-fix-fd-leak-in-ext4_ioc_move_ext-cross-sb-validation.patch
and it can be found in the queue-6.12 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From stable+bounces-289044-greg=kroah.com@vger.kernel.org Sat Jul 25 04:41:06 2026
From: Yun Zhou <yun.zhou@windriver.com>
Date: Sat, 25 Jul 2026 10:40:29 +0800
Subject: ext4: fix fd leak in EXT4_IOC_MOVE_EXT cross-sb validation
To: <gregkh@linuxfoundation.org>
Cc: <harshit.m.mogalapalli@oracle.com>, <stable@vger.kernel.org>, <patches@lists.linux.dev>
Message-ID: <20260725024029.1217577-1-yun.zhou@windriver.com>
From: Yun Zhou <yun.zhou@windriver.com>
The backport of upstream commit c143957520c6 ("ext4: validate donor
file superblock early in EXT4_IOC_MOVE_EXT") uses a bare 'return -EXDEV'
which is safe upstream because the fd is managed via CLASS(fd) with
automatic cleanup (commit 8152f8201088 ("fdget(), more trivial
conversions")).
However, on 6.12.y the ioctl still uses the traditional fdget/fdput
pattern, so the bare return bypasses fdput(donor) at the mext_out label,
leaking the file reference.
Fix by setting err and using goto mext_out.
Fixes: 74796e886ca3 ("ext4: validate donor file superblock early in EXT4_IOC_MOVE_EXT")
Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Signed-off-by: Yun Zhou <yun.zhou@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/ext4/ioctl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -1372,8 +1372,10 @@ group_extend_out:
goto mext_out;
}
- if (file_inode(filp)->i_sb != file_inode(fd_file(donor))->i_sb)
- return -EXDEV;
+ if (file_inode(filp)->i_sb != file_inode(fd_file(donor))->i_sb) {
+ err = -EXDEV;
+ goto mext_out;
+ }
err = mnt_want_write_file(filp);
if (err)
Patches currently in stable-queue which might be from yun.zhou@windriver.com are
queue-6.12/ext4-fix-fd-leak-in-ext4_ioc_move_ext-cross-sb-validation.patch
prev parent reply other threads:[~2026-07-25 6:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-25 2:40 [PATCH 6.12.y] ext4: fix fd leak in EXT4_IOC_MOVE_EXT cross-sb validation Yun Zhou
2026-07-25 6:02 ` gregkh [this message]
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=2026072503-jab-tabby-8f6d@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=harshit.m.mogalapalli@oracle.com \
--cc=patches@lists.linux.dev \
--cc=stable-commits@vger.kernel.org \
--cc=yun.zhou@windriver.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.