From 481a9b8073a448f0bd151b7171dbab18b35de55c Mon Sep 17 00:00:00 2001 From: YueHaibing Date: Fri, 10 May 2019 11:21:44 +0800 Subject: ubifs: Fix build error without CONFIG_UBIFS_FS_XATTR Fix gcc build error while CONFIG_UBIFS_FS_XATTR is not set fs/ubifs/dir.o: In function `ubifs_unlink': dir.c:(.text+0x260): undefined reference to `ubifs_purge_xattrs' fs/ubifs/dir.o: In function `do_rename': dir.c:(.text+0x1edc): undefined reference to `ubifs_purge_xattrs' fs/ubifs/dir.o: In function `ubifs_rmdir': dir.c:(.text+0x2638): undefined reference to `ubifs_purge_xattrs' Reported-by: Hulk Robot Fixes: 9ca2d7326444 ("ubifs: Limit number of xattrs per inode") Signed-off-by: YueHaibing Signed-off-by: Richard Weinberger --- fs/ubifs/ubifs.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 379b9f791ff6..fd7f39990157 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -2015,13 +2015,17 @@ int ubifs_xattr_set(struct inode *host, const char *name, const void *value, size_t size, int flags, bool check_lock); ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf, size_t size); -int ubifs_purge_xattrs(struct inode *host); #ifdef CONFIG_UBIFS_FS_XATTR void ubifs_evict_xattr_inode(struct ubifs_info *c, ino_t xattr_inum); +int ubifs_purge_xattrs(struct inode *host); #else static inline void ubifs_evict_xattr_inode(struct ubifs_info *c, ino_t xattr_inum) { } +static inline int ubifs_purge_xattrs(struct inode *host) +{ + return 0; +} #endif #ifdef CONFIG_UBIFS_FS_SECURITY -- cgit v1.2.3 From 76aa349441729d889ba6f1d58e3369d178250ffd Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Tue, 14 May 2019 21:10:49 +0200 Subject: ubifs: Use correct config name for encryption CONFIG_UBIFS_FS_ENCRYPTION is gone, fscrypt is now controlled via CONFIG_FS_ENCRYPTION. This problem slipped into the tree because of a mis-merge on my side. Reported-by: Eric Biggers Fixes: eea2c05d927b ("ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION") Signed-off-by: Richard Weinberger --- fs/ubifs/sb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index 2afc8b1d4c3b..3ca41965db6e 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c @@ -748,7 +748,7 @@ int ubifs_read_superblock(struct ubifs_info *c) goto out; } - if (!IS_ENABLED(CONFIG_UBIFS_FS_ENCRYPTION) && c->encrypted) { + if (!IS_ENABLED(CONFIG_FS_ENCRYPTION) && c->encrypted) { ubifs_err(c, "file system contains encrypted files but UBIFS" " was built without crypto support."); err = -EINVAL; @@ -941,7 +941,7 @@ int ubifs_enable_encryption(struct ubifs_info *c) int err; struct ubifs_sb_node *sup = c->sup_node; - if (!IS_ENABLED(CONFIG_UBIFS_FS_ENCRYPTION)) + if (!IS_ENABLED(CONFIG_FS_ENCRYPTION)) return -EOPNOTSUPP; if (c->encrypted) -- cgit v1.2.3 From 4dd0481584d09221849ac8a3af4cd3cefd58c11e Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Tue, 14 May 2019 21:10:50 +0200 Subject: ubifs: Convert xattr inum to host order UBIFS stores inode numbers as LE64 integers. We have to convert them to host oder, otherwise BE hosts won't be able to use the integer correctly. Reported-by: kbuild test robot Fixes: 9ca2d7326444 ("ubifs: Limit number of xattrs per inode") Signed-off-by: Richard Weinberger --- fs/ubifs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index acab3181ab35..bcfed27e8997 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c @@ -527,7 +527,7 @@ int ubifs_purge_xattrs(struct inode *host) fname_name(&nm) = xent->name; fname_len(&nm) = le16_to_cpu(xent->nlen); - xino = ubifs_iget(c->vfs_sb, xent->inum); + xino = ubifs_iget(c->vfs_sb, le64_to_cpu(xent->inum)); if (IS_ERR(xino)) { err = PTR_ERR(xino); ubifs_err(c, "dead directory entry '%s', error %d", -- cgit v1.2.3