浏览代码

drm: Fix a bug in the range manager.

When searching for free space in a range, the function could return a node extending outside of the given range.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Thomas Hellstrom 15 年之前
父节点
当前提交
775c67090c
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      drivers/gpu/drm/drm_mm.c

+ 2 - 1
drivers/gpu/drm/drm_mm.c

@@ -405,7 +405,8 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm,
 				wasted += alignment - tmp;
 		}
 
-		if (entry->size >= size + wasted) {
+		if (entry->size >= size + wasted &&
+		    (entry->start + wasted + size) <= end) {
 			if (!best_match)
 				return entry;
 			if (entry->size < best_size) {