Commit aec86d43 authored by Chengguang Xu's avatar Chengguang Xu Committed by Kleber Sacilotto de Souza

chardev: add additional check for minor range overlap

BugLink: https://bugs.launchpad.net/bugs/1832661

[ Upstream commit de36e16d ]

Current overlap checking cannot correctly handle
a case which is baseminor < existing baseminor &&
baseminor + minorct > existing baseminor + minorct.
Signed-off-by: default avatarChengguang Xu <cgxu519@gmx.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 1f026fc0
......@@ -130,6 +130,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment