Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocfs2: add extra flags check in ocfs2_ioctl_move_extents()

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.

Link: https://lkml.kernel.org/r/20251009102349.181126-1-dmantipov@yandex.ru
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Jun Piao <piaojun@huawei.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Mark Fasheh <mark@fasheh.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Dmitry Antipov and committed by
Andrew Morton
41a5e877 55b453ed

+6
+6
fs/ocfs2/move_extents.c
··· 1036 1036 if (range.me_threshold > i_size_read(inode)) 1037 1037 range.me_threshold = i_size_read(inode); 1038 1038 1039 + if (range.me_flags & ~(OCFS2_MOVE_EXT_FL_AUTO_DEFRAG | 1040 + OCFS2_MOVE_EXT_FL_PART_DEFRAG)) { 1041 + status = -EINVAL; 1042 + goto out_free; 1043 + } 1044 + 1039 1045 if (range.me_flags & OCFS2_MOVE_EXT_FL_AUTO_DEFRAG) { 1040 1046 context->auto_defrag = 1; 1041 1047