Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be36af2b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drm/msm: fix leak in failed get_pages"

parents 0a3cd753 0bcaa07a
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -113,13 +113,15 @@ static struct page **get_pages(struct drm_gem_object *obj)
			return p;
		}

		msm_obj->pages = p;

		msm_obj->sgt = drm_prime_pages_to_sg(p, npages);
		if (IS_ERR(msm_obj->sgt)) {
			dev_err(dev->dev, "failed to allocate sgt\n");
			return ERR_CAST(msm_obj->sgt);
		}
			void *ptr = ERR_CAST(msm_obj->sgt);

		msm_obj->pages = p;
			msm_obj->sgt = NULL;
			return ptr;
		}

		/*
		 * Make sure to flush the CPU cache for newly allocated memory
@@ -157,6 +159,7 @@ static void put_pages(struct drm_gem_object *obj)
			msm_obj->flags &= ~MSM_BO_LOCKED;
		}

		if (msm_obj->sgt)
			sg_free_table(msm_obj->sgt);
		kfree(msm_obj->sgt);