Skip to content

Commit

Permalink
Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/nvdimm/nvdimm

Pull libnvdimm fix from Dan Williams:
 "We expanded the device-dax fs type in 4.12 to be a generic provider of
  a struct dax_device with an embedded inode. However, Sasha found some
  basic negative testing was not run to verify that this fs cleanly
  handles being mounted directly.

  Note that the fresh rebase was done to remove an unnecessary Cc:
  <stable> tag, but this commit otherwise had a build success
  notification from the 0day robot."

* 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
  device-dax: fix 'dax' device filesystem inode destruction crash
  • Loading branch information
torvalds committed Jun 11, 2017
2 parents 9d66af6 + b9d39d1 commit 8f56821
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/dax/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,12 @@ EXPORT_SYMBOL_GPL(kill_dax);
static struct inode *dax_alloc_inode(struct super_block *sb)
{
struct dax_device *dax_dev;
struct inode *inode;

dax_dev = kmem_cache_alloc(dax_cache, GFP_KERNEL);
return &dax_dev->inode;
inode = &dax_dev->inode;
inode->i_rdev = 0;
return inode;
}

static struct dax_device *to_dax_dev(struct inode *inode)
Expand All @@ -227,7 +230,8 @@ static void dax_i_callback(struct rcu_head *head)

kfree(dax_dev->host);
dax_dev->host = NULL;
ida_simple_remove(&dax_minor_ida, MINOR(inode->i_rdev));
if (inode->i_rdev)
ida_simple_remove(&dax_minor_ida, MINOR(inode->i_rdev));
kmem_cache_free(dax_cache, dax_dev);
}

Expand Down Expand Up @@ -423,6 +427,7 @@ static void init_once(void *_dax_dev)
struct dax_device *dax_dev = _dax_dev;
struct inode *inode = &dax_dev->inode;

memset(dax_dev, 0, sizeof(*dax_dev));
inode_init_once(inode);
}

Expand Down

0 comments on commit 8f56821

Please sign in to comment.