From: Zhihao Cheng Date: Mon, 17 Aug 2020 14:29:09 +0000 (+0800) Subject: ubifs: ubifs_jnl_change_xattr: Remove assertion 'nlink > 0' for host inode X-Git-Tag: Ubuntu-5.10.0-12.13~1648^2~2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=dd7db149bcd914db8fdeb19cd5597c0740121bc7;p=mirror_ubuntu-hirsute-kernel.git ubifs: ubifs_jnl_change_xattr: Remove assertion 'nlink > 0' for host inode Changing xattr of a temp file will trigger following assertion failed and make ubifs turn into readonly filesystem: ubifs_assert_failed [ubifs]: UBIFS assert failed: host->i_nlink > 0, in fs/ubifs/journal.c:1801 Reproducer: 1. fd = open(__O_TMPFILE) 2. fsetxattr(fd, key, value2, XATTR_CREATE) 3. fsetxattr(fd, key, value2, XATTR_REPLACE) Fix this by removing assertion 'nlink > 0' for host inode. Reported-by: Chengsong Ke Signed-off-by: Zhihao Cheng Signed-off-by: Richard Weinberger --- diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index ed935aefe3e0..cb1fa0c37322 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c @@ -1800,7 +1800,6 @@ int ubifs_jnl_change_xattr(struct ubifs_info *c, const struct inode *inode, u8 hash[UBIFS_HASH_ARR_SZ]; dbg_jnl("ino %lu, ino %lu", host->i_ino, inode->i_ino); - ubifs_assert(c, host->i_nlink > 0); ubifs_assert(c, inode->i_nlink > 0); ubifs_assert(c, mutex_is_locked(&host_ui->ui_mutex));