diff mbox series

[1/2] drm/msm: Fix leak in submitqueue create

Message ID 1535959485-27440-1-git-send-email-smasetty@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/msm: Fix leak in submitqueue create | expand

Commit Message

Sharat Masetty Sept. 3, 2018, 7:24 a.m. UTC
This patch fixes a trivial leak when trying to create a submitqueue.

Signed-off-by: Sharat Masetty <smasetty@codeaurora.org>
---
 drivers/gpu/drm/msm/msm_submitqueue.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jordan Crouse Sept. 5, 2018, 4:22 p.m. UTC | #1
On Mon, Sep 03, 2018 at 12:54:44PM +0530, Sharat Masetty wrote:
> This patch fixes a trivial leak when trying to create a submitqueue.
> 
> Signed-off-by: Sharat Masetty <smasetty@codeaurora.org>

Doh. Thanks.

Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/msm_submitqueue.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c b/drivers/gpu/drm/msm/msm_submitqueue.c
> index 5115f75..325da44 100644
> --- a/drivers/gpu/drm/msm/msm_submitqueue.c
> +++ b/drivers/gpu/drm/msm/msm_submitqueue.c
> @@ -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;
>  	}
> -- 
> 1.9.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c b/drivers/gpu/drm/msm/msm_submitqueue.c
index 5115f75..325da44 100644
--- a/drivers/gpu/drm/msm/msm_submitqueue.c
+++ b/drivers/gpu/drm/msm/msm_submitqueue.c
@@ -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;
 	}