I've noticed message on kvm exit:
Warning: serial8250__exit failed.
kvm tool is not able to remove ioport range which was added previously.
The issue is caused by bug in rbtree-interval. Search algorithm in
rb_int_search_single() expects correct value of max_high. But the tree
can contain leaf nodes, which never were updated by propagate_callback().
For this kind of nodes high_max will be 0 and we will not be able to
find and remove them.
Let's initialize max_high on RB_INT_INIT() time.
Fixing this bug makes other bug visible: propagate_callback() can be
called for empty tree: node == NULL. The callback is not ready for empty
tree. Let's fix that as well.
Tested-by: William Dauchy <william@gandi.net>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
#include <linux/rbtree_augmented.h>
#include <linux/types.h>
-#define RB_INT_INIT(l, h) (struct rb_int_node){.low = l, .high = h}
+#define RB_INT_INIT(l, h) \
+ (struct rb_int_node){.low = l, .high = h, .max_high = h}
#define rb_int(n) rb_entry(n, struct rb_int_node, node)
struct rb_int_node {
*/
static void propagate_callback(struct rb_node *node, struct rb_node *stop)
{
- struct rb_int_node *i_node = rb_int(node);
+ struct rb_int_node *i_node;
+ if (node == stop)
+ return;
+
+ i_node = rb_int(node);
i_node->max_high = i_node->high;
if (node->rb_left)