drm/msm: Fix leak in submitqueue create
Subsystems (5)
DRM drivers DRM misc Arm Qualcomm mailing list DRM driver for Qualcomm display hardware +1 more subsystems
PATCH 1/2 drm/msm: Fix leak in submitqueue create
This patch fixes a trivial leak when trying to create a submitqueue.
Signed-off-by Sharat Masetty <[email protected]>
--- drivers/gpu/drm/msm/msm_submitqueue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_submitqueue.c +3 -1
@@ -78,8 +78,10 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx, queue->flags = flags;if (priv->gpu) { -if (prio >= priv->gpu->nr_rings) +if (prio >= priv->gpu->nr_rings) { +kfree (queue);return -EINVAL ; + } queue->prio = prio; }
Signature · 6 lines
1.9.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
A message that is not in the archive (sent off-list or not yet received): 1535959485-27440-1-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
PATCH 2/2 drm/scheduler: set sched->thread to NULL in failure
In cases where the scheduler instance is used a base object of another vendor driver object, it's not clear if the driver can call sched cleanup on the fail path. Set the sched->thread to NULL, so that the vendor driver can safely call drm_sched_fini() during cleanup.
Signed-off-by Sharat Masetty <[email protected]>
--- drivers/gpu/drm/scheduler/gpu_scheduler.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/scheduler/gpu_scheduler.c +4 -2
@@ -760,7 +760,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,long timeout, const char *name) { - int i; + int i, ret; sched->ops = ops; sched->hw_submission_limit = hw_submission; sched->name = name;
@@ -779,8 +779,10 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,/* Each scheduler will run on a seperate kernel thread */ sched->thread =kthread_run (drm_sched_main, sched, sched->name);if (IS_ERR (sched->thread)) { + ret =PTR_ERR (sched->thread); + sched->thread =NULL ;DRM_ERROR ("Failed to create scheduler for %s.\n" , name); -return PTR_ERR (sched->thread); +return ret; }return 0 ;
Signature · 6 lines
1.9.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Jordan Crouse
Reviewed-byQuoted 3 lines · Sharat Masetty
This patch fixes a trivial leak when trying to create a submitqueue.
Signed-off-by Sharat Masetty <[email protected]>
Doh. Thanks.
Reviewed-by Jordan Crouse <[email protected]>
Quoted 23 lines
--- drivers/gpu/drm/msm/msm_submitqueue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/msm/msm_submitqueue.c +3
-1@@ -78,8 +78,10 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx, queue->flags = flags;if (priv->gpu) { -if (prio >= priv->gpu->nr_rings) +if (prio >= priv->gpu->nr_rings) { +kfree (queue);return -EINVAL ; + } queue->prio = prio; }Signature · 1 line
1.9.1
Signature · 6 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno