diff options
author | Richard Weinberger <richard@nod.at> | 2016-06-13 00:49:03 +0200 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2016-06-14 10:51:42 +0200 |
commit | 1a498ec45eeabcb246c3c3f5822ed9ac1b4f70d8 (patch) | |
tree | a5896d3a06815735df07a090adeecef2646e24ec /drivers/mtd | |
parent | ad022c87187b50f50937bd9bcd1ef312442a89af (diff) | |
download | linux-1a498ec45eeabcb246c3c3f5822ed9ac1b4f70d8.tar.gz linux-1a498ec45eeabcb246c3c3f5822ed9ac1b4f70d8.tar.bz2 linux-1a498ec45eeabcb246c3c3f5822ed9ac1b4f70d8.zip |
Revert "mtd: switch open_mtd_by_chdev() to use of vfs_stat()"
This reverts commit 87f15d4add758fb7fc76655721af94be57a4c17d.
vfs_stat() can only be used on user supplied buffers.
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/ubi/build.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 16baeb51b2bd..7091fca0fb44 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -1147,19 +1147,22 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) */ static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev) { - struct kstat stat; - int err, minor; + int err, major, minor, mode; + struct path 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); /* MTD device number is defined by the major / minor numbers */ - if (MAJOR(stat.rdev) != MTD_CHAR_MAJOR || !S_ISCHR(stat.mode)) + major = imajor(d_backing_inode(path.dentry)); + minor = iminor(d_backing_inode(path.dentry)); + mode = d_backing_inode(path.dentry)->i_mode; + path_put(&path); + if (major != MTD_CHAR_MAJOR || !S_ISCHR(mode)) return ERR_PTR(-EINVAL); - minor = MINOR(stat.rdev); if (minor & 1) /* * Just do not think the "/dev/mtdrX" devices support is need, |