From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E65D2A1BA; Tue, 8 Jul 2025 16:27:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751992062; cv=none; b=A+/VIdhyCeDh/CH1Ys+BU3bDxCi0Qv9GWwaTqZO/zhGnQJ/sHfX81SpQUxKewSrIMwMwDPeSPK33V9Fnq4zxsW6S31kpwKdteuMW/ml5CYigeBtOLjuBZSDFQ+Bh8tJcO/wwc0DXZIDVAdwykD27ezNLZEG8gxyK4DksZ+dC7zs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751992062; c=relaxed/simple; bh=w3M1IemtThE0WUaEefTikqE4Ztv5XESoa/SHxkU1l7U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ByvSIxvQc98ensFZPuygVTFtlzeI1zOAMS3Qn4k+b3l0SZrZkCnLOtgBQKTv9eSEbVp6hg1+/mleZEqGCrqPRVWovcNEunn3Z00JvJU6lZ4CqQttTllMxfZyEm6nW3X9AckfyAiSSImHg/qgzUQpVjfCGbrNAy8zyTUAEGOg4WY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=c6n7sT4E; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="c6n7sT4E" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91B8AC4CEED; Tue, 8 Jul 2025 16:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751992062; bh=w3M1IemtThE0WUaEefTikqE4Ztv5XESoa/SHxkU1l7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c6n7sT4EFS5mKwDdLP/do6fG7LMKOXFTL1oWfAPTrkFrQd26/RJR8m7ogocvfn73H 8ucxaa7uDYQB0r2LUPOBznD0sqZ7FgkAIwdi2oPEKDixxOwHeYgKZe11/ZCYNkDrxX efp+UL4ox4ffiNfFA1y0258XBmHfL3opHP90CWjM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rob Clark , Rob Clark , Sasha Levin Subject: [PATCH 6.1 45/81] drm/msm: Fix another leak in the submit error path Date: Tue, 8 Jul 2025 18:23:37 +0200 Message-ID: <20250708162226.459289131@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250708162224.795155912@linuxfoundation.org> References: <20250708162224.795155912@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rob Clark [ Upstream commit f681c2aa8676a890eacc84044717ab0fd26e058f ] put_unused_fd() doesn't free the installed file, if we've already done fd_install(). So we need to also free the sync_file. Signed-off-by: Rob Clark Patchwork: https://patchwork.freedesktop.org/patch/653583/ Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_gem_submit.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index 4ee6aeb23c512..572dd662e8095 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -724,6 +724,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, struct msm_ringbuffer *ring; struct msm_submit_post_dep *post_deps = NULL; struct drm_syncobj **syncobjs_to_reset = NULL; + struct sync_file *sync_file = NULL; int out_fence_fd = -1; bool has_ww_ticket = false; unsigned i; @@ -927,7 +928,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, } if (ret == 0 && args->flags & MSM_SUBMIT_FENCE_FD_OUT) { - struct sync_file *sync_file = sync_file_create(submit->user_fence); + sync_file = sync_file_create(submit->user_fence); if (!sync_file) { ret = -ENOMEM; } else { @@ -958,8 +959,11 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, out_unlock: mutex_unlock(&queue->lock); out_post_unlock: - if (ret && (out_fence_fd >= 0)) + if (ret && (out_fence_fd >= 0)) { put_unused_fd(out_fence_fd); + if (sync_file) + fput(sync_file->file); + } if (!IS_ERR_OR_NULL(submit)) { msm_gem_submit_put(submit); -- 2.39.5