aboutsummaryrefslogtreecommitdiffstats
path: root/fs/char_dev.c
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@gmx.com>2019-02-15 07:27:11 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-02 11:49:58 -0400
commitde36e16d1557a0b6eb328bc3516359a12ba5c25c (patch)
treed02cd16c0450168be4a8e9346989971b8deb10d1 /fs/char_dev.c
parent9a41691e5e01ba38865afa7a1eaa352974bf4a6e (diff)
chardev: add additional check for minor range overlap
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>
Diffstat (limited to 'fs/char_dev.c')
-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,
159 ret = -EBUSY; 159 ret = -EBUSY;
160 goto out; 160 goto out;
161 } 161 }
162
163 if (new_min < old_min && new_max > old_max) {
164 ret = -EBUSY;
165 goto out;
166 }
167
162 } 168 }
163 169
164 cd->next = *cp; 170 cd->next = *cp;