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>
This commit is contained in:
parent
9a41691e5e
commit
de36e16d15
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue