aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@gmx.com>2019-02-15 20:27:11 +0800
committerPaul Gortmaker <paul.gortmaker@windriver.com>2019-08-17 13:30:38 -0400
commitebbe8b16aaa73c87589b2ae7e466736022f7a910 (patch)
treeec448da41a55ceb5f052ee0794ef04f85ae25429 /fs
parentcb8a97490c1755b35cd57bbf228776ecff557b5e (diff)
downloadlinux-yocto-ebbe8b16aaa73c87589b2ae7e466736022f7a910.tar.gz
linux-yocto-ebbe8b16aaa73c87589b2ae7e466736022f7a910.tar.bz2
linux-yocto-ebbe8b16aaa73c87589b2ae7e466736022f7a910.zip
chardev: add additional check for minor range overlap
commit de36e16d1557a0b6eb328bc3516359a12ba5c25c upstream. Current overlap checking cannot correctly handle a case which is baseminor < existing baseminor && baseminor + minorct > existing baseminor + minorct. Signed-off-by: Chengguang Xu <cgxu519@gmx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/char_dev.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c
index a279c58fe360..8a63cfa29005 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -159,6 +159,12 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor,
ret = -EBUSY;
goto out;
}
+
+ if (new_min < old_min && new_max > old_max) {
+ ret = -EBUSY;
+ goto out;
+ }
+
}
cd->next = *cp;