From: Chris Mason Date: Thu, 11 Jun 2009 15:13:35 +0000 (-0400) Subject: Btrfs: fix oops when btrfs_inherit_iflags called with a NULL dir X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0b4dcea579a1b6f4d249d61f5bc8adeaa7c895d8;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git Btrfs: fix oops when btrfs_inherit_iflags called with a NULL dir This happens during subvol creation. Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 926332a73cde..eff18f5b5362 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -112,7 +112,12 @@ void btrfs_update_iflags(struct inode *inode) */ void btrfs_inherit_iflags(struct inode *inode, struct inode *dir) { - unsigned int flags = BTRFS_I(dir)->flags; + unsigned int flags; + + if (!dir) + return; + + flags = BTRFS_I(dir)->flags; if (S_ISREG(inode->i_mode)) flags &= ~BTRFS_INODE_DIRSYNC;