All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ocfs2: add extra flags check in ocfs2_ioctl_move_extents()
@ 2025-10-08 11:20 Dmitry Antipov
  2025-10-09  2:15 ` Joseph Qi
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Antipov @ 2025-10-08 11:20 UTC (permalink / raw)
  To: Mark Fasheh, Joel Becker, Joseph Qi
  Cc: ocfs2-devel, lvc-project, Dmitry Antipov,
	syzbot+727d161855d11d81e411

In 'ocfs2_ioctl_move_extents()', add extra check whether only actually
supported flags are passed via 'ioctl(..., OCFS2_IOC_MOVE_EXT, ...)',
and reject anything beyond OCFS2_MOVE_EXT_FL_AUTO_DEFRAG and
OCFS2_MOVE_EXT_FL_PART_DEFRAG with -EINVAL. In particular,
OCFS2_MOVE_EXT_FL_COMPLETE may be set by the kernel only and
should never be passed from userspace.

Reported-by: syzbot+727d161855d11d81e411@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=727d161855d11d81e411
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 fs/ocfs2/move_extents.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
index 86f2631e6360..e038c009cdef 100644
--- a/fs/ocfs2/move_extents.c
+++ b/fs/ocfs2/move_extents.c
@@ -1031,6 +1031,12 @@ int ocfs2_ioctl_move_extents(struct file *filp, void __user *argp)
 	if (range.me_threshold > i_size_read(inode))
 		range.me_threshold = i_size_read(inode);
 
+	if (range.me_flags & ~(OCFS2_MOVE_EXT_FL_AUTO_DEFRAG |
+			       OCFS2_MOVE_EXT_FL_PART_DEFRAG)) {
+		status = -EINVAL;
+		goto out_free;
+	}
+
 	if (range.me_flags & OCFS2_MOVE_EXT_FL_AUTO_DEFRAG) {
 		context->auto_defrag = 1;
 
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-11-12 18:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08 11:20 [PATCH] ocfs2: add extra flags check in ocfs2_ioctl_move_extents() Dmitry Antipov
2025-10-09  2:15 ` Joseph Qi
2025-10-09  6:39   ` Dmitry Antipov
2025-10-09  7:51     ` Joseph Qi
2025-10-09 10:23       ` [PATCH 1/2] " Dmitry Antipov
2025-10-09 10:23         ` [PATCH 2/2] ocfs2: relax BUG() to ocfs2_error() in __ocfs2_move_extent() Dmitry Antipov
2025-10-09 11:12           ` Joseph Qi
2025-11-12  8:30             ` Andy Shevchenko
2025-11-12 18:02               ` Andrew Morton
2025-10-09 11:07         ` [PATCH 1/2] ocfs2: add extra flags check in ocfs2_ioctl_move_extents() Joseph Qi
2025-10-09 10:25       ` [PATCH] " Dmitry Antipov

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.