panfrost: Don't double-free when handling error for unsupported GPU
Setting the screen ro member before we checked gpu id means the error case leads to a double-free because screen->ro is set and allocated by parent who hanbdles de-alloc a second time after we destroyed the screen we just created because ro was set. Cc: mesa-stable Signed-off-by: Carsten Haitzler <carsten.haitzler@foss.arm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14516>
This commit is contained in:
committed by
Marge Bot
parent
7553aee06b
commit
874f4095c5
@@ -854,8 +854,6 @@ panfrost_create_screen(int fd, struct renderonly *ro)
|
||||
if (dev->debug & PAN_DBG_NO_AFBC)
|
||||
dev->has_afbc = false;
|
||||
|
||||
dev->ro = ro;
|
||||
|
||||
/* Check if we're loading against a supported GPU model. */
|
||||
|
||||
switch (dev->gpu_id) {
|
||||
@@ -876,6 +874,8 @@ panfrost_create_screen(int fd, struct renderonly *ro)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dev->ro = ro;
|
||||
|
||||
screen->base.destroy = panfrost_destroy_screen;
|
||||
|
||||
screen->base.get_name = panfrost_get_name;
|
||||
|
||||
Reference in New Issue
Block a user