summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-table.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-25 11:19:46 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-25 11:19:46 +0100
commit0f8b29fabacbcf0e617896c7ea832b7ea2ef2406 (patch)
tree0187f2baef24b5d78d94aecc7057356a36c58b5d /drivers/md/dm-table.c
parenttty: fix up iterate_tty_read() EOVERFLOW handling (diff)
parentLinux 5.11-rc5 (diff)
downloadlinux-0f8b29fabacbcf0e617896c7ea832b7ea2ef2406.tar.xz
linux-0f8b29fabacbcf0e617896c7ea832b7ea2ef2406.zip
Merge 5.11-rc5 into tty-next
We need the fixes in here and this resolves a merge issue in drivers/tty/tty_io.c Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r--drivers/md/dm-table.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 188f41287f18..4acf2342f7ad 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -363,14 +363,23 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
{
int r;
dev_t dev;
+ unsigned int major, minor;
+ char dummy;
struct dm_dev_internal *dd;
struct dm_table *t = ti->table;
BUG_ON(!t);
- dev = dm_get_dev_t(path);
- if (!dev)
- return -ENODEV;
+ if (sscanf(path, "%u:%u%c", &major, &minor, &dummy) == 2) {
+ /* Extract the major/minor numbers */
+ dev = MKDEV(major, minor);
+ if (MAJOR(dev) != major || MINOR(dev) != minor)
+ return -EOVERFLOW;
+ } else {
+ dev = dm_get_dev_t(path);
+ if (!dev)
+ return -ENODEV;
+ }
dd = find_device(&t->devices, dev);
if (!dd) {