Skip to content

Commit 0b4dcea

Browse files
committed
Btrfs: fix oops when btrfs_inherit_iflags called with a NULL dir
This happens during subvol creation. Signed-off-by: Chris Mason <chris.mason@oracle.com>
1 parent 067c28a commit 0b4dcea

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

fs/btrfs/ioctl.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,12 @@ void btrfs_update_iflags(struct inode *inode)
112112
*/
113113
void btrfs_inherit_iflags(struct inode *inode, struct inode *dir)
114114
{
115-
unsigned int flags = BTRFS_I(dir)->flags;
115+
unsigned int flags;
116+
117+
if (!dir)
118+
return;
119+
120+
flags = BTRFS_I(dir)->flags;
116121

117122
if (S_ISREG(inode->i_mode))
118123
flags &= ~BTRFS_INODE_DIRSYNC;

0 commit comments

Comments
 (0)