iris/bufmgr: Handle NULL bufmgr in iris_bufmgr_get_for_fd

iris_bufmgr_create can return NULL, in which case we'd crash in
list_addtail.

Reported by Coverity/clang (for i965, but iris code looks the same).

Fixes: 7557f16059 ("iris: share buffer managers accross screens")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7335>
(cherry picked from commit 1eda842318)
This commit is contained in:
Michel Dänzer 2020-10-28 11:56:27 +01:00 committed by Dylan Baker
parent 436592d1f4
commit 9f3d7d54d8
2 changed files with 3 additions and 2 deletions

View file

@ -5548,7 +5548,7 @@
"description": "iris/bufmgr: Handle NULL bufmgr in iris_bufmgr_get_for_fd",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "7557f1605968c39d680545d5b8457d17eea3b922"
},

View file

@ -1940,7 +1940,8 @@ iris_bufmgr_get_for_fd(struct gen_device_info *devinfo, int fd, bool bo_reuse)
}
bufmgr = iris_bufmgr_create(devinfo, fd, bo_reuse);
list_addtail(&bufmgr->link, &global_bufmgr_list);
if (bufmgr)
list_addtail(&bufmgr->link, &global_bufmgr_list);
unlock:
mtx_unlock(&global_bufmgr_list_mutex);