Date: Wed, 5 Apr 2023 18:38:54 +0200 The label “out_prevalid” was used to jump to another pointer check despite of the detail in the implementation of the function “nouveau_gem_ioctl_pushbuf” that it was determined already in one case that the corresponding variable contained an error pointer because of a failed call of the function “u_memcpya”. Thus use an additional label. This issue was detected by using the Coccinelle software. Fixes: 2be65641642ef423f82162c3a5f28c754d1637d2 ("drm/nouveau: fix relocations applying logic and a double-free") Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/nouveau/nouveau_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index f77e44958037..d87e1cb2c933 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -814,7 +814,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, reloc = u_memcpya(req->relocs, req->nr_relocs, sizeof(*reloc)); if (IS_ERR(reloc)) { ret = PTR_ERR(reloc); - goto out_prevalid; + goto out_free_bo; } goto revalidate; @@ -929,6 +929,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, out_prevalid: if (!IS_ERR(reloc)) u_free(reloc); +out_free_bo: u_free(bo); u_free(push); -- 2.40.0