diff options
author | Zhihao Cheng <chengzhihao1@huawei.com> | 2021-12-27 11:22:39 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-04-08 14:40:39 +0200 |
commit | d07a2421693162d89a5c1033e0d1794c8a53dc8c (patch) | |
tree | 8e0d04dd7b464cd10463ba2e8ff99a24a289d66d /fs | |
parent | 13b2a8151e3be5e03bc07236a2c55c156261d45a (diff) | |
download | linux-stable-d07a2421693162d89a5c1033e0d1794c8a53dc8c.tar.gz linux-stable-d07a2421693162d89a5c1033e0d1794c8a53dc8c.tar.bz2 linux-stable-d07a2421693162d89a5c1033e0d1794c8a53dc8c.zip |
ubifs: setflags: Make dirtied_ino_d 8 bytes aligned
commit 1b83ec057db16b4d0697dc21ef7a9743b6041f72 upstream.
Make 'ui->data_len' aligned with 8 bytes before it is assigned to
dirtied_ino_d. Since 8871d84c8f8b0c6b("ubifs: convert to fileattr")
applied, 'setflags()' only affects regular files and directories, only
xattr inode, symlink inode and special inode(pipe/char_dev/block_dev)
have none- zero 'ui->data_len' field, so assertion
'!(req->dirtied_ino_d & 7)' cannot fail in ubifs_budget_space().
To avoid assertion fails in future evolution(eg. setflags can operate
special inodes), it's better to make dirtied_ino_d 8 bytes aligned,
after all aligned size is still zero for regular files.
Fixes: 1e51764a3c2ac05a ("UBIFS: add new flash file system")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ubifs/ioctl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c index 4363d85a3fd4..8db380a00032 100644 --- a/fs/ubifs/ioctl.c +++ b/fs/ubifs/ioctl.c @@ -107,7 +107,7 @@ static int setflags(struct inode *inode, int flags) struct ubifs_inode *ui = ubifs_inode(inode); struct ubifs_info *c = inode->i_sb->s_fs_info; struct ubifs_budget_req req = { .dirtied_ino = 1, - .dirtied_ino_d = ui->data_len }; + .dirtied_ino_d = ALIGN(ui->data_len, 8) }; err = ubifs_budget_space(c, &req); if (err) |