Skip to content

Commit

Permalink
Fix do_setxattr
Browse files Browse the repository at this point in the history
  • Loading branch information
anodos325 committed Oct 31, 2024
1 parent 8472eb6 commit 8a1aae1
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,13 @@ int do_setxattr(struct mnt_idmap *idmap, struct dentry *dentry,
return do_set_acl(idmap, dentry, ctx->kname->name,
ctx->kvalue, ctx->size);

#ifdef CONFIG_TRUENAS
if (ctx->size &&
(ctx->size > XATTR_SIZE_MAX) &&
(IS_LARGE_XATTR(d->d_inode) == 0)) {
return -E2BIG;
}
#endif
return vfs_setxattr(idmap, dentry, ctx->kname->name,
ctx->kvalue, ctx->size, ctx->flags);
}
Expand All @@ -677,17 +684,6 @@ static int path_setxattr(const char __user *pathname,
const char __user *name, const void __user *value,
size_t size, int flags, unsigned int lookup_flags)
{
#ifdef CONFIG_TRUENAS
if (size) {
if (size > XATTR_SIZE_MAX) {
if ((size > XATTR_LARGE_SIZE_MAX) ||
(IS_LARGE_XATTR(d->d_inode) == 0)) {
return -E2BIG;
}
}
}
#endif

struct xattr_name kname;
struct xattr_ctx ctx = {
.cvalue = value,
Expand Down

0 comments on commit 8a1aae1

Please sign in to comment.