diff options
author | Christian König <christian.koenig@amd.com> | 2016-01-11 09:35:18 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-01-13 12:18:31 -0500 |
commit | 33d48cf8256f2b72e4082a7996c04bf1e78fce81 (patch) | |
tree | 9a05c37f961a6f0ef83fca1715218d2eb06f0068 /drivers/gpu/drm/ttm | |
parent | e3837b00b6bb2b0344dd28c601edda8eba42de7f (diff) |
drm/ttm: fix adding foreign BOs to the LRU during init v2
If we import a BO with an external reservation object we don't
reserve/unreserve it. So we never add it to the LRU causing a possible
denial of service.
v2: fix typo in commit message
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 745e996d2dbc..a98a5d5d756d 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -1170,9 +1170,15 @@ int ttm_bo_init(struct ttm_bo_device *bdev, | |||
1170 | if (likely(!ret)) | 1170 | if (likely(!ret)) |
1171 | ret = ttm_bo_validate(bo, placement, interruptible, false); | 1171 | ret = ttm_bo_validate(bo, placement, interruptible, false); |
1172 | 1172 | ||
1173 | if (!resv) | 1173 | if (!resv) { |
1174 | ttm_bo_unreserve(bo); | 1174 | ttm_bo_unreserve(bo); |
1175 | 1175 | ||
1176 | } else if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { | ||
1177 | spin_lock(&bo->glob->lru_lock); | ||
1178 | ttm_bo_add_to_lru(bo); | ||
1179 | spin_unlock(&bo->glob->lru_lock); | ||
1180 | } | ||
1181 | |||
1176 | if (unlikely(ret)) | 1182 | if (unlikely(ret)) |
1177 | ttm_bo_unref(&bo); | 1183 | ttm_bo_unref(&bo); |
1178 | 1184 | ||