All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nouveau: Don't leak in nva3_pm_clock_pre()
@ 2011-07-03  9:58 ` Jesper Juhl
  0 siblings, 0 replies; 4+ messages in thread
From: Jesper Juhl @ 2011-07-03  9:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: dri-devel, Ben Skeggs, David Airlie

If nva3_calc_pll() returns less than 0 in
drivers/gpu/drm/nouveau/nva3_pm.c:nva3_pm_clock_pre() we'll return
without freeing 'pll'.
This patch should fix the leak.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/gpu/drm/nouveau/nva3_pm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

  Compile tested only - no hardware to test for real.

diff --git a/drivers/gpu/drm/nouveau/nva3_pm.c b/drivers/gpu/drm/nouveau/nva3_pm.c
index e4b2b9e..80443d2 100644
--- a/drivers/gpu/drm/nouveau/nva3_pm.c
+++ b/drivers/gpu/drm/nouveau/nva3_pm.c
@@ -137,8 +137,10 @@ nva3_pm_clock_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl,
 
 	if (!pll->new_div) {
 		ret = nva3_calc_pll(dev, &limits, khz, &N, NULL, &M, &P);
-		if (ret < 0)
+		if (ret < 0) {
+			kfree(pll);
 			return ERR_PTR(ret);
+		}
 
 		pll->new_pnm = (P << 16) | (N << 8) | M;
 		pll->new_div = 2 - 1;
-- 
1.7.6


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


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

* [PATCH] nouveau: Don't leak in nva3_pm_clock_pre()
@ 2011-07-03  9:58 ` Jesper Juhl
  0 siblings, 0 replies; 4+ messages in thread
From: Jesper Juhl @ 2011-07-03  9:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ben Skeggs, dri-devel

If nva3_calc_pll() returns less than 0 in
drivers/gpu/drm/nouveau/nva3_pm.c:nva3_pm_clock_pre() we'll return
without freeing 'pll'.
This patch should fix the leak.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/gpu/drm/nouveau/nva3_pm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

  Compile tested only - no hardware to test for real.

diff --git a/drivers/gpu/drm/nouveau/nva3_pm.c b/drivers/gpu/drm/nouveau/nva3_pm.c
index e4b2b9e..80443d2 100644
--- a/drivers/gpu/drm/nouveau/nva3_pm.c
+++ b/drivers/gpu/drm/nouveau/nva3_pm.c
@@ -137,8 +137,10 @@ nva3_pm_clock_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl,
 
 	if (!pll->new_div) {
 		ret = nva3_calc_pll(dev, &limits, khz, &N, NULL, &M, &P);
-		if (ret < 0)
+		if (ret < 0) {
+			kfree(pll);
 			return ERR_PTR(ret);
+		}
 
 		pll->new_pnm = (P << 16) | (N << 8) | M;
 		pll->new_div = 2 - 1;
-- 
1.7.6


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

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

* Re: [PATCH] nouveau: Don't leak in nva3_pm_clock_pre()
  2011-07-03  9:58 ` Jesper Juhl
@ 2011-07-03 23:42   ` Ben Skeggs
  -1 siblings, 0 replies; 4+ messages in thread
From: Ben Skeggs @ 2011-07-03 23:42 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, Ben Skeggs, dri-devel

On Sun, Jul 3, 2011 at 7:58 PM, Jesper Juhl <jj@chaosbits.net> wrote:
> If nva3_calc_pll() returns less than 0 in
> drivers/gpu/drm/nouveau/nva3_pm.c:nva3_pm_clock_pre() we'll return
> without freeing 'pll'.
> This patch should fix the leak.
Firstly, thank you for the patch.

This issue however, no longer exists in nouveau git.  The patches
fixing it will make their way to Linus' tree.

Ben.

>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
>  drivers/gpu/drm/nouveau/nva3_pm.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
>  Compile tested only - no hardware to test for real.
>
> diff --git a/drivers/gpu/drm/nouveau/nva3_pm.c b/drivers/gpu/drm/nouveau/nva3_pm.c
> index e4b2b9e..80443d2 100644
> --- a/drivers/gpu/drm/nouveau/nva3_pm.c
> +++ b/drivers/gpu/drm/nouveau/nva3_pm.c
> @@ -137,8 +137,10 @@ nva3_pm_clock_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl,
>
>        if (!pll->new_div) {
>                ret = nva3_calc_pll(dev, &limits, khz, &N, NULL, &M, &P);
> -               if (ret < 0)
> +               if (ret < 0) {
> +                       kfree(pll);
>                        return ERR_PTR(ret);
> +               }
>
>                pll->new_pnm = (P << 16) | (N << 8) | M;
>                pll->new_div = 2 - 1;
> --
> 1.7.6
>
>
> --
> Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
> Don't top-post http://www.catb.org/jargon/html/T/top-post.html
> Plain text mails only, please.
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

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

* Re: [PATCH] nouveau: Don't leak in nva3_pm_clock_pre()
@ 2011-07-03 23:42   ` Ben Skeggs
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Skeggs @ 2011-07-03 23:42 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, dri-devel, Ben Skeggs

On Sun, Jul 3, 2011 at 7:58 PM, Jesper Juhl <jj@chaosbits.net> wrote:
> If nva3_calc_pll() returns less than 0 in
> drivers/gpu/drm/nouveau/nva3_pm.c:nva3_pm_clock_pre() we'll return
> without freeing 'pll'.
> This patch should fix the leak.
Firstly, thank you for the patch.

This issue however, no longer exists in nouveau git.  The patches
fixing it will make their way to Linus' tree.

Ben.

>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
>  drivers/gpu/drm/nouveau/nva3_pm.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
>  Compile tested only - no hardware to test for real.
>
> diff --git a/drivers/gpu/drm/nouveau/nva3_pm.c b/drivers/gpu/drm/nouveau/nva3_pm.c
> index e4b2b9e..80443d2 100644
> --- a/drivers/gpu/drm/nouveau/nva3_pm.c
> +++ b/drivers/gpu/drm/nouveau/nva3_pm.c
> @@ -137,8 +137,10 @@ nva3_pm_clock_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl,
>
>        if (!pll->new_div) {
>                ret = nva3_calc_pll(dev, &limits, khz, &N, NULL, &M, &P);
> -               if (ret < 0)
> +               if (ret < 0) {
> +                       kfree(pll);
>                        return ERR_PTR(ret);
> +               }
>
>                pll->new_pnm = (P << 16) | (N << 8) | M;
>                pll->new_div = 2 - 1;
> --
> 1.7.6
>
>
> --
> Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
> Don't top-post http://www.catb.org/jargon/html/T/top-post.html
> Plain text mails only, please.
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

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

end of thread, other threads:[~2011-07-03 23:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-03  9:58 [PATCH] nouveau: Don't leak in nva3_pm_clock_pre() Jesper Juhl
2011-07-03  9:58 ` Jesper Juhl
2011-07-03 23:42 ` Ben Skeggs
2011-07-03 23:42   ` Ben Skeggs

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.