diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2021-01-20 16:12:53 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-20 17:05:51 +0300 |
commit | 6bcc0590cb919bb0c37b554afdaa929528f7bebc (patch) | |
tree | 1b546aaee88fa5ca77526904aaee06948b8bfd87 /fs/ubifs | |
parent | aab881d7f074e302451cfa3d85d30ba6b1cf3e13 (diff) | |
download | linux-6bcc0590cb919bb0c37b554afdaa929528f7bebc.tar.xz |
ubifs: Fix off-by-one error
[ Upstream commit d984bcf5766dbdbe95d325bb8a1b49a996fecfd4 ]
An inode is allowed to have ubifs_xattr_max_cnt() xattrs, so we must
complain only when an inode has more xattrs, having exactly
ubifs_xattr_max_cnt() xattrs is fine.
With this the maximum number of xattrs can be created without hitting
the "has too many xattrs" warning when removing it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/journal.c | 2 | ||||
-rw-r--r-- | fs/ubifs/xattr.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index 091c2ad8f211..7927dea2baba 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c @@ -881,7 +881,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode) struct inode *xino; struct ubifs_dent_node *xent, *pxent = NULL; - if (ui->xattr_cnt >= ubifs_xattr_max_cnt(c)) { + if (ui->xattr_cnt > ubifs_xattr_max_cnt(c)) { ubifs_err(c, "Cannot delete inode, it has too much xattrs!"); goto out_release; } diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index 09280796fc61..17745f5462f0 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c @@ -512,7 +512,7 @@ int ubifs_purge_xattrs(struct inode *host) struct fscrypt_name nm = {0}; int err; - if (ubifs_inode(host)->xattr_cnt < ubifs_xattr_max_cnt(c)) + if (ubifs_inode(host)->xattr_cnt <= ubifs_xattr_max_cnt(c)) return 0; ubifs_warn(c, "inode %lu has too many xattrs, doing a non-atomic deletion", |