btrfs: fix unaligned access in readdir
authorDavid Sterba <dsterba@suse.com>
Mon, 16 Apr 2018 19:10:14 +0000 (21:10 +0200)
committerDavid Sterba <dsterba@suse.com>
Wed, 18 Apr 2018 22:35:08 +0000 (00:35 +0200)
commit92d32170847bfff2dd08af2c016085779f2fd2a1
treea86cbb655e5a787084da9c57b96de6bdcfd93b2e
parent336a8bb8e36a273a802a54b2e673c777c9c62fb1
btrfs: fix unaligned access in readdir

The last update to readdir introduced a temporary buffer to store the
emitted readdir data, but as there are file names of variable length,
there's a lot of unaligned access.

This was observed on a sparc64 machine:

  Kernel unaligned access at TPC[102f3080] btrfs_real_readdir+0x51c/0x718 [btrfs]

Fixes: 23b5ec74943 ("btrfs: fix readdir deadlock with pagefault")
CC: stable@vger.kernel.org # 4.14+
Reported-and-tested-by: René Rebe <rene@exactcode.com>
Reviewed-by: Liu Bo <bo.liu@linux.alibaba.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c