]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/tegra: Add call to put_pid()
authorPrateek Agarwal <praagarwal@nvidia.com>
Fri, 19 Sep 2025 04:25:40 +0000 (13:25 +0900)
committerThierry Reding <treding@nvidia.com>
Fri, 14 Nov 2025 17:17:51 +0000 (18:17 +0100)
Add a call to put_pid() corresponding to get_task_pid().
host1x_memory_context_alloc() does not take ownership of the PID so we
need to free it here to avoid leaking.

Signed-off-by: Prateek Agarwal <praagarwal@nvidia.com>
Fixes: e09db97889ec ("drm/tegra: Support context isolation")
[mperttunen@nvidia.com: reword commit message]
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patch.msgid.link/20250919-host1x-put-pid-v1-1-19c2163dfa87@nvidia.com
drivers/gpu/drm/tegra/uapi.c

index 5adab6b229164eed6ec1830243ad9f9e5b5147f6..d0b6a1fa6efad9bf945ca6d85c61431f1c2f255f 100644 (file)
@@ -114,9 +114,12 @@ int tegra_drm_ioctl_channel_open(struct drm_device *drm, void *data, struct drm_
                if (err)
                        goto put_channel;
 
-               if (supported)
+               if (supported) {
+                       struct pid *pid = get_task_pid(current, PIDTYPE_TGID);
                        context->memory_context = host1x_memory_context_alloc(
-                               host, client->base.dev, get_task_pid(current, PIDTYPE_TGID));
+                               host, client->base.dev, pid);
+                       put_pid(pid);
+               }
 
                if (IS_ERR(context->memory_context)) {
                        if (PTR_ERR(context->memory_context) != -EOPNOTSUPP) {