chardev: add additional check for minor range overlap

[ Upstream commit de36e16d15 ]

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>
This commit is contained in:
Chengguang Xu 2019-02-15 20:27:11 +08:00 коммит произвёл Greg Kroah-Hartman
Родитель 06c239a1a0
Коммит ed3f381e10
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -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;