Commit abd38301 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'upstream-4.7-rc4' of git://git.infradead.org/linux-ubifs

Pull UBI fixes from Richard Weinberger:
 "This contains fixes for a regression introduced in rc1"

* tag 'upstream-4.7-rc4' of git://git.infradead.org/linux-ubifs:
  ubi: Don't bypass ->getattr()
  Revert "mtd: switch open_mtd_by_chdev() to use of vfs_stat()"
  Revert "mtd: switch ubi_open_volume_path() to vfs_stat()"
parents f66c6e6a 61edc3f3
...@@ -1147,11 +1147,17 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) ...@@ -1147,11 +1147,17 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
*/ */
static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev) static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev)
{ {
struct kstat stat;
int err, minor; int err, minor;
struct path path;
struct kstat stat;
/* Probably this is an MTD character device node path */ /* Probably this is an MTD character device node path */
err = vfs_stat(mtd_dev, &stat); err = kern_path(mtd_dev, LOOKUP_FOLLOW, &path);
if (err)
return ERR_PTR(err);
err = vfs_getattr(&path, &stat);
path_put(&path);
if (err) if (err)
return ERR_PTR(err); return ERR_PTR(err);
...@@ -1160,6 +1166,7 @@ static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev) ...@@ -1160,6 +1166,7 @@ static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
minor = MINOR(stat.rdev); minor = MINOR(stat.rdev);
if (minor & 1) if (minor & 1)
/* /*
* Just do not think the "/dev/mtdrX" devices support is need, * Just do not think the "/dev/mtdrX" devices support is need,
......
...@@ -302,6 +302,7 @@ EXPORT_SYMBOL_GPL(ubi_open_volume_nm); ...@@ -302,6 +302,7 @@ EXPORT_SYMBOL_GPL(ubi_open_volume_nm);
struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode) struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode)
{ {
int error, ubi_num, vol_id; int error, ubi_num, vol_id;
struct path path;
struct kstat stat; struct kstat stat;
dbg_gen("open volume %s, mode %d", pathname, mode); dbg_gen("open volume %s, mode %d", pathname, mode);
...@@ -309,7 +310,12 @@ struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode) ...@@ -309,7 +310,12 @@ struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode)
if (!pathname || !*pathname) if (!pathname || !*pathname)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
error = vfs_stat(pathname, &stat); error = kern_path(pathname, LOOKUP_FOLLOW, &path);
if (error)
return ERR_PTR(error);
error = vfs_getattr(&path, &stat);
path_put(&path);
if (error) if (error)
return ERR_PTR(error); return ERR_PTR(error);
......
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