Commit 8f56821d authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/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
parents 9d66af6b b9d39d17
...@@ -210,9 +210,12 @@ EXPORT_SYMBOL_GPL(kill_dax); ...@@ -210,9 +210,12 @@ EXPORT_SYMBOL_GPL(kill_dax);
static struct inode *dax_alloc_inode(struct super_block *sb) static struct inode *dax_alloc_inode(struct super_block *sb)
{ {
struct dax_device *dax_dev; struct dax_device *dax_dev;
struct inode *inode;
dax_dev = kmem_cache_alloc(dax_cache, GFP_KERNEL); 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) static struct dax_device *to_dax_dev(struct inode *inode)
...@@ -227,7 +230,8 @@ static void dax_i_callback(struct rcu_head *head) ...@@ -227,7 +230,8 @@ static void dax_i_callback(struct rcu_head *head)
kfree(dax_dev->host); kfree(dax_dev->host);
dax_dev->host = NULL; 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); kmem_cache_free(dax_cache, dax_dev);
} }
...@@ -423,6 +427,7 @@ static void init_once(void *_dax_dev) ...@@ -423,6 +427,7 @@ static void init_once(void *_dax_dev)
struct dax_device *dax_dev = _dax_dev; struct dax_device *dax_dev = _dax_dev;
struct inode *inode = &dax_dev->inode; struct inode *inode = &dax_dev->inode;
memset(dax_dev, 0, sizeof(*dax_dev));
inode_init_once(inode); inode_init_once(inode);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment