Commit d984bcf5 authored by Sascha Hauer's avatar Sascha Hauer Committed by Richard Weinberger
Browse files

ubifs: Fix off-by-one error



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: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 410b6de7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
		}
+1 −1
Original line number Diff line number Diff line
@@ -498,7 +498,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",