summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/fs-ioctl.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2023-09-15 14:55:23 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:10:14 +0200
commit1f12900ab52304a7c41714b6ad86990eb428fbc9 (patch)
treeacca1b733982384dbfb11d88643589c4fcbbbd3d /fs/bcachefs/fs-ioctl.c
parentbcachefs: acl: Add missing check in bch2_acl_chmod() (diff)
downloadlinux-1f12900ab52304a7c41714b6ad86990eb428fbc9.tar.xz
linux-1f12900ab52304a7c41714b6ad86990eb428fbc9.zip
bcachefs: fs-ioctl: Fix copy_to_user() error code
The copy_to_user() function returns the number of bytes that it wasn't able to copy but we want to return -EFAULT to the user. Fixes: e0750d947352 ("bcachefs: Initial commit") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fs-ioctl.c')
-rw-r--r--fs/bcachefs/fs-ioctl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/fs-ioctl.c b/fs/bcachefs/fs-ioctl.c
index 141bcced031e..0679b2f79fd6 100644
--- a/fs/bcachefs/fs-ioctl.c
+++ b/fs/bcachefs/fs-ioctl.c
@@ -122,7 +122,10 @@ static int bch2_ioc_fsgetxattr(struct bch_inode_info *inode,
fa.fsx_projid = inode->ei_qid.q[QTYP_PRJ];
- return copy_to_user(arg, &fa, sizeof(fa));
+ if (copy_to_user(arg, &fa, sizeof(fa)))
+ return -EFAULT;
+
+ return 0;
}
static int fssetxattr_inode_update_fn(struct btree_trans *trans,