]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
reiserfs: Initialize inode keys properly
authorJan Kara <jack@suse.cz>
Mon, 21 Sep 2020 13:08:50 +0000 (15:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Oct 2020 09:03:31 +0000 (11:03 +0200)
commit 4443390e08d34d5771ab444f601cf71b3c9634a4 upstream.

reiserfs_read_locked_inode() didn't initialize key length properly. Use
_make_cpu_key() macro for key initialization so that all key member are
properly initialized.

CC: stable@vger.kernel.org
Reported-by: syzbot+d94d02749498bb7bab4b@syzkaller.appspotmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/reiserfs/inode.c

index 60ba35087d12697eb9bc80c03073fc840edc9b2e..cfb4691d927411188923fc14b12e3cf9c14daa76 100644 (file)
@@ -1553,11 +1553,7 @@ void reiserfs_read_locked_inode(struct inode *inode,
         * set version 1, version 2 could be used too, because stat data
         * key is the same in both versions
         */
-       key.version = KEY_FORMAT_3_5;
-       key.on_disk_key.k_dir_id = dirino;
-       key.on_disk_key.k_objectid = inode->i_ino;
-       key.on_disk_key.k_offset = 0;
-       key.on_disk_key.k_type = 0;
+       _make_cpu_key(&key, KEY_FORMAT_3_5, dirino, inode->i_ino, 0, 0, 3);
 
        /* look for the object's stat data */
        retval = search_item(inode->i_sb, &key, &path_to_sd);