summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@gmx.com>2019-02-15 20:27:11 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-31 06:46:27 -0700
commit65ec64f28a882096d9976963e2ccefd85085fb1a (patch)
treea2ee29fc4a812999206f1a209e7a90d36d7053ca /fs
parentfc242af86d0713d7a1edd7b757d92fb03b3047e0 (diff)
downloadlinux-rpi3-65ec64f28a882096d9976963e2ccefd85085fb1a.tar.gz
linux-rpi3-65ec64f28a882096d9976963e2ccefd85085fb1a.tar.bz2
linux-rpi3-65ec64f28a882096d9976963e2ccefd85085fb1a.zip
chardev: add additional check for minor range overlap
[ Upstream commit de36e16d1557a0b6eb328bc3516359a12ba5c25c ] 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: Sasha Levin <sashal@kernel.org>
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;