Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] drm/amd/display: fix double memory allocation" failed to apply to 6.3-stable tree
@ 2023-05-13  7:20 gregkh
  2023-05-13 12:28 ` Mario Limonciello
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2023-05-13  7:20 UTC (permalink / raw)
  To: Martin.Leung, Hanghong.Ma, alexander.deucher, daniel.wheeler,
	mario.limonciello, qingqing.zhuo
  Cc: stable


The patch below does not apply to the 6.3-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.3.y
git checkout FETCH_HEAD
git cherry-pick -x f5442b35e69e42015ef3082008c0d85cdcc0ca05
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2023051306-elves-dividers-01e7@gregkh' --subject-prefix 'PATCH 6.3.y' HEAD^..

Possible dependencies:

f5442b35e69e ("drm/amd/display: fix double memory allocation")
b5006f873b99 ("drm/amd/display: initialize link_srv in virtual env")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From f5442b35e69e42015ef3082008c0d85cdcc0ca05 Mon Sep 17 00:00:00 2001
From: Martin Leung <Martin.Leung@amd.com>
Date: Tue, 14 Mar 2023 09:27:20 -0400
Subject: [PATCH] drm/amd/display: fix double memory allocation

[Why & How]
when trying to fix a nullptr dereference on VMs,
accidentally doubly allocated memory for the non VM
case. removed the extra link_srv creation since
dc_construct_ctx is called in both VM and non VM cases
Also added a proper fail check for if kzalloc fails

Cc: stable@vger.kernel.org
Cc: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Leo Ma <Hanghong.Ma@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Martin Leung <Martin.Leung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 40f2e174c524..52564b93f7eb 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -887,7 +887,10 @@ static bool dc_construct_ctx(struct dc *dc,
 	}
 
 	dc->ctx = dc_ctx;
+
 	dc->link_srv = link_create_link_service();
+	if (!dc->link_srv)
+		return false;
 
 	return true;
 }
@@ -986,8 +989,6 @@ static bool dc_construct(struct dc *dc,
 		goto fail;
 	}
 
-	dc->link_srv = link_create_link_service();
-
 	dc->res_pool = dc_create_resource_pool(dc, init_params, dc_ctx->dce_version);
 	if (!dc->res_pool)
 		goto fail;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] drm/amd/display: fix double memory allocation" failed to apply to 6.3-stable tree
  2023-05-13  7:20 FAILED: patch "[PATCH] drm/amd/display: fix double memory allocation" failed to apply to 6.3-stable tree gregkh
@ 2023-05-13 12:28 ` Mario Limonciello
  2023-05-13 12:59   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello @ 2023-05-13 12:28 UTC (permalink / raw)
  To: gregkh, Martin.Leung, Hanghong.Ma, alexander.deucher,
	daniel.wheeler, mario.limonciello, qingqing.zhuo
  Cc: stable

On 5/13/23 02:20, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 6.3-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
> 
> To reproduce the conflict and resubmit, you may use the following commands:
> 
> git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.3.y
> git checkout FETCH_HEAD
> git cherry-pick -x f5442b35e69e42015ef3082008c0d85cdcc0ca05
> # <resolve conflicts, build, test, etc.>
> git commit -s
> git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2023051306-elves-dividers-01e7@gregkh' --subject-prefix 'PATCH 6.3.y' HEAD^..
> 
> Possible dependencies:
> 
> f5442b35e69e ("drm/amd/display: fix double memory allocation")
> b5006f873b99 ("drm/amd/display: initialize link_srv in virtual env")
> 
> thanks,
> 
> greg k-h
> 
> ------------------ original commit in Linus's tree ------------------
> 
>  From f5442b35e69e42015ef3082008c0d85cdcc0ca05 Mon Sep 17 00:00:00 2001
> From: Martin Leung <Martin.Leung@amd.com>
> Date: Tue, 14 Mar 2023 09:27:20 -0400
> Subject: [PATCH] drm/amd/display: fix double memory allocation
> 
> [Why & How]
> when trying to fix a nullptr dereference on VMs,
> accidentally doubly allocated memory for the non VM
> case. removed the extra link_srv creation since
> dc_construct_ctx is called in both VM and non VM cases
> Also added a proper fail check for if kzalloc fails
> 
> Cc: stable@vger.kernel.org
> Cc: Mario Limonciello <mario.limonciello@amd.com>
> Reviewed-by: Leo Ma <Hanghong.Ma@amd.com>
> Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
> Signed-off-by: Martin Leung <Martin.Leung@amd.com>
> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> index 40f2e174c524..52564b93f7eb 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> @@ -887,7 +887,10 @@ static bool dc_construct_ctx(struct dc *dc,
>   	}
>   
>   	dc->ctx = dc_ctx;
> +
>   	dc->link_srv = link_create_link_service();
> +	if (!dc->link_srv)
> +		return false;
>   
>   	return true;
>   }
> @@ -986,8 +989,6 @@ static bool dc_construct(struct dc *dc,
>   		goto fail;
>   	}
>   
> -	dc->link_srv = link_create_link_service();
> -
>   	dc->res_pool = dc_create_resource_pool(dc, init_params, dc_ctx->dce_version);
>   	if (!dc->res_pool)
>   		goto fail;
> 

FYI -
This particular commit didn't need to come back to any stable channels 
as the commit it fixed
b5006f873b99 ("drm/amd/display: initialize link_srv in virtual env")
is only present in 6.4.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] drm/amd/display: fix double memory allocation" failed to apply to 6.3-stable tree
  2023-05-13 12:28 ` Mario Limonciello
@ 2023-05-13 12:59   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2023-05-13 12:59 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: Martin.Leung, Hanghong.Ma, alexander.deucher, daniel.wheeler,
	mario.limonciello, qingqing.zhuo, stable

On Sat, May 13, 2023 at 07:28:20AM -0500, Mario Limonciello wrote:
> On 5/13/23 02:20, gregkh@linuxfoundation.org wrote:
> > 
> > The patch below does not apply to the 6.3-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> > 
> > To reproduce the conflict and resubmit, you may use the following commands:
> > 
> > git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.3.y
> > git checkout FETCH_HEAD
> > git cherry-pick -x f5442b35e69e42015ef3082008c0d85cdcc0ca05
> > # <resolve conflicts, build, test, etc.>
> > git commit -s
> > git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2023051306-elves-dividers-01e7@gregkh' --subject-prefix 'PATCH 6.3.y' HEAD^..
> > 
> > Possible dependencies:
> > 
> > f5442b35e69e ("drm/amd/display: fix double memory allocation")
> > b5006f873b99 ("drm/amd/display: initialize link_srv in virtual env")
> > 
> > thanks,
> > 
> > greg k-h
> > 
> > ------------------ original commit in Linus's tree ------------------
> > 
> >  From f5442b35e69e42015ef3082008c0d85cdcc0ca05 Mon Sep 17 00:00:00 2001
> > From: Martin Leung <Martin.Leung@amd.com>
> > Date: Tue, 14 Mar 2023 09:27:20 -0400
> > Subject: [PATCH] drm/amd/display: fix double memory allocation
> > 
> > [Why & How]
> > when trying to fix a nullptr dereference on VMs,
> > accidentally doubly allocated memory for the non VM
> > case. removed the extra link_srv creation since
> > dc_construct_ctx is called in both VM and non VM cases
> > Also added a proper fail check for if kzalloc fails
> > 
> > Cc: stable@vger.kernel.org
> > Cc: Mario Limonciello <mario.limonciello@amd.com>
> > Reviewed-by: Leo Ma <Hanghong.Ma@amd.com>
> > Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
> > Signed-off-by: Martin Leung <Martin.Leung@amd.com>
> > Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > 
> > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> > index 40f2e174c524..52564b93f7eb 100644
> > --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> > +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> > @@ -887,7 +887,10 @@ static bool dc_construct_ctx(struct dc *dc,
> >   	}
> >   	dc->ctx = dc_ctx;
> > +
> >   	dc->link_srv = link_create_link_service();
> > +	if (!dc->link_srv)
> > +		return false;
> >   	return true;
> >   }
> > @@ -986,8 +989,6 @@ static bool dc_construct(struct dc *dc,
> >   		goto fail;
> >   	}
> > -	dc->link_srv = link_create_link_service();
> > -
> >   	dc->res_pool = dc_create_resource_pool(dc, init_params, dc_ctx->dce_version);
> >   	if (!dc->res_pool)
> >   		goto fail;
> > 
> 
> FYI -
> This particular commit didn't need to come back to any stable channels as
> the commit it fixed
> b5006f873b99 ("drm/amd/display: initialize link_srv in virtual env")
> is only present in 6.4.

Any reason why a "Fixes:" tag wasn't added here?  That would have made
it much easier to figure this all out :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-13 13:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-13  7:20 FAILED: patch "[PATCH] drm/amd/display: fix double memory allocation" failed to apply to 6.3-stable tree gregkh
2023-05-13 12:28 ` Mario Limonciello
2023-05-13 12:59   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox