All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Archit Taneja <architt@codeaurora.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@gmail.com>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	LKML <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Archit Taneja <archit@ti.com>
Subject: [PATCH] drm/mgag200: Fix calling drm_fb_helper_fini() twice
Date: Wed, 16 Sep 2015 11:46:48 +0200	[thread overview]
Message-ID: <20150916094648.GA11711@gmail.com> (raw)
In-Reply-To: <55F6E68D.8070800@codeaurora.org>


* Archit Taneja <architt@codeaurora.org> wrote:

> From: Archit Taneja <architt@codeaurora.org>
> Date: Mon, 14 Sep 2015 20:11:43 +0530
> Subject: [PATCH] drm/mgag200: Prevent calling drm_fb_helper_fini twice
> 
> mgag200_fbdev_init's error handling path calls drm_fb_helper_fini before
> bailing out. The error handling path of mgag200_driver_load also ends
> up calling drm_fb_helper_fini.
> 
> This results in drm_fb_helper_fini being called twice if the driver load
> drm op fails somewhere in between.
> 
> Make only mgag200_driver_unload call drm_fb_helper_fini, remove the call
> from mgag200_fbdev_init.
> 
> Signed-off-by: Archit Taneja <architt@codeaurora.org>
> ---
>  drivers/gpu/drm/mgag200/mgag200_fb.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c
> b/drivers/gpu/drm/mgag200/mgag200_fb.c
> index 87de15e..6259b0a 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_fb.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
> @@ -280,20 +280,16 @@ int mgag200_fbdev_init(struct mga_device *mdev)
> 
>  	ret = drm_fb_helper_single_add_all_connectors(&mfbdev->helper);
>  	if (ret)
> -		goto fini;
> +		return ret;
> 
>  	/* disable all the possible outputs/crtcs before entering KMS mode */
>  	drm_helper_disable_unused_functions(mdev->dev);
> 
>  	ret = drm_fb_helper_initial_config(&mfbdev->helper, bpp_sel);
>  	if (ret)
> -		goto fini;
> +		return ret;
> 
>  	return 0;
> -
> -fini:
> -	drm_fb_helper_fini(&mfbdev->helper);
> -	return ret;
>  }
> 
>  void mgag200_fbdev_fini(struct mga_device *mdev)

So this patch was whitespace damaged - I applied it by hand and made the commit 
below. This has solved the crash, thanks Archit!

And yes, you are right that my config probably crashed with older kernels too.

	Ingo

=============>
>From 60d733a3ec19dc72372e12207a0a86293cd40cf5 Mon Sep 17 00:00:00 2001
From: Archit Taneja <architt@codeaurora.org>
Date: Mon, 14 Sep 2015 20:53:57 +0530
Subject: [PATCH] drm/mgag200: Fix calling drm_fb_helper_fini() twice

mgag200_fbdev_init()'s error handling path calls
drm_fb_helper_fini() before bailing out. The error handling path
of mgag200_driver_load() also ends up calling drm_fb_helper_fini().

This results in drm_fb_helper_fini() being called twice if the
driver load drm op fails somewhere in between.

Make only mgag200_driver_unload() call drm_fb_helper_fini(), remove
the call from mgag200_fbdev_init().

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Cc: Archit Taneja <archit@ti.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: dri-devel <dri-devel@lists.freedesktop.org>
Link: http://lkml.kernel.org/r/55F6E68D.8070800@codeaurora.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 drivers/gpu/drm/mgag200/mgag200_fb.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 87de15ea1f93..6259b0a5fc38 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -280,20 +280,16 @@ int mgag200_fbdev_init(struct mga_device *mdev)
 
 	ret = drm_fb_helper_single_add_all_connectors(&mfbdev->helper);
 	if (ret)
-		goto fini;
+		return ret;
 
 	/* disable all the possible outputs/crtcs before entering KMS mode */
 	drm_helper_disable_unused_functions(mdev->dev);
 
 	ret = drm_fb_helper_initial_config(&mfbdev->helper, bpp_sel);
 	if (ret)
-		goto fini;
+		return ret;
 
 	return 0;
-
-fini:
-	drm_fb_helper_fini(&mfbdev->helper);
-	return ret;
 }
 
 void mgag200_fbdev_fini(struct mga_device *mdev)

WARNING: multiple messages have this Message-ID (diff)
From: Ingo Molnar <mingo@kernel.org>
To: Archit Taneja <architt@codeaurora.org>
Cc: Dave Airlie <airlied@gmail.com>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	LKML <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Archit Taneja <archit@ti.com>
Subject: [PATCH] drm/mgag200: Fix calling drm_fb_helper_fini() twice
Date: Wed, 16 Sep 2015 11:46:48 +0200	[thread overview]
Message-ID: <20150916094648.GA11711@gmail.com> (raw)
In-Reply-To: <55F6E68D.8070800@codeaurora.org>


* Archit Taneja <architt@codeaurora.org> wrote:

> From: Archit Taneja <architt@codeaurora.org>
> Date: Mon, 14 Sep 2015 20:11:43 +0530
> Subject: [PATCH] drm/mgag200: Prevent calling drm_fb_helper_fini twice
> 
> mgag200_fbdev_init's error handling path calls drm_fb_helper_fini before
> bailing out. The error handling path of mgag200_driver_load also ends
> up calling drm_fb_helper_fini.
> 
> This results in drm_fb_helper_fini being called twice if the driver load
> drm op fails somewhere in between.
> 
> Make only mgag200_driver_unload call drm_fb_helper_fini, remove the call
> from mgag200_fbdev_init.
> 
> Signed-off-by: Archit Taneja <architt@codeaurora.org>
> ---
>  drivers/gpu/drm/mgag200/mgag200_fb.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c
> b/drivers/gpu/drm/mgag200/mgag200_fb.c
> index 87de15e..6259b0a 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_fb.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
> @@ -280,20 +280,16 @@ int mgag200_fbdev_init(struct mga_device *mdev)
> 
>  	ret = drm_fb_helper_single_add_all_connectors(&mfbdev->helper);
>  	if (ret)
> -		goto fini;
> +		return ret;
> 
>  	/* disable all the possible outputs/crtcs before entering KMS mode */
>  	drm_helper_disable_unused_functions(mdev->dev);
> 
>  	ret = drm_fb_helper_initial_config(&mfbdev->helper, bpp_sel);
>  	if (ret)
> -		goto fini;
> +		return ret;
> 
>  	return 0;
> -
> -fini:
> -	drm_fb_helper_fini(&mfbdev->helper);
> -	return ret;
>  }
> 
>  void mgag200_fbdev_fini(struct mga_device *mdev)

So this patch was whitespace damaged - I applied it by hand and made the commit 
below. This has solved the crash, thanks Archit!

And yes, you are right that my config probably crashed with older kernels too.

	Ingo

=============>
>From 60d733a3ec19dc72372e12207a0a86293cd40cf5 Mon Sep 17 00:00:00 2001
From: Archit Taneja <architt@codeaurora.org>
Date: Mon, 14 Sep 2015 20:53:57 +0530
Subject: [PATCH] drm/mgag200: Fix calling drm_fb_helper_fini() twice

mgag200_fbdev_init()'s error handling path calls
drm_fb_helper_fini() before bailing out. The error handling path
of mgag200_driver_load() also ends up calling drm_fb_helper_fini().

This results in drm_fb_helper_fini() being called twice if the
driver load drm op fails somewhere in between.

Make only mgag200_driver_unload() call drm_fb_helper_fini(), remove
the call from mgag200_fbdev_init().

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Cc: Archit Taneja <archit@ti.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: dri-devel <dri-devel@lists.freedesktop.org>
Link: http://lkml.kernel.org/r/55F6E68D.8070800@codeaurora.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 drivers/gpu/drm/mgag200/mgag200_fb.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 87de15ea1f93..6259b0a5fc38 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -280,20 +280,16 @@ int mgag200_fbdev_init(struct mga_device *mdev)
 
 	ret = drm_fb_helper_single_add_all_connectors(&mfbdev->helper);
 	if (ret)
-		goto fini;
+		return ret;
 
 	/* disable all the possible outputs/crtcs before entering KMS mode */
 	drm_helper_disable_unused_functions(mdev->dev);
 
 	ret = drm_fb_helper_initial_config(&mfbdev->helper, bpp_sel);
 	if (ret)
-		goto fini;
+		return ret;
 
 	return 0;
-
-fini:
-	drm_fb_helper_fini(&mfbdev->helper);
-	return ret;
 }
 
 void mgag200_fbdev_fini(struct mga_device *mdev)

  reply	other threads:[~2015-09-16  9:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-07 11:58 [PATCH] drm/mgag200: fix memory leak Sudip Mukherjee
2015-09-07 11:58 ` Sudip Mukherjee
2015-09-13  9:36 ` Ingo Molnar
2015-09-14  8:44   ` Sudip Mukherjee
2015-09-14  8:44     ` Sudip Mukherjee
2015-09-14  9:06     ` Ingo Molnar
2015-09-14 10:04   ` Dave Airlie
2015-09-14 10:04     ` Dave Airlie
2015-09-14 10:05     ` Dave Airlie
2015-09-14 10:29       ` Sudip Mukherjee
2015-09-14 10:29         ` Sudip Mukherjee
2015-09-14 15:23       ` Archit Taneja
2015-09-14 15:23         ` Archit Taneja
2015-09-16  9:46         ` Ingo Molnar [this message]
2015-09-16  9:46           ` [PATCH] drm/mgag200: Fix calling drm_fb_helper_fini() twice Ingo Molnar
2015-09-17  8:34           ` Ingo Molnar
2015-09-17 10:54             ` Archit Taneja
2015-09-17 10:54               ` Archit Taneja
2015-09-17 11:17               ` Sudip Mukherjee
2015-09-17 11:17                 ` Sudip Mukherjee
2015-10-03 10:55               ` Ingo Molnar
2015-09-24 15:53 ` [PATCH] drm/mgag200: fix memory leak Sudip Mukherjee
2015-09-24 15:53   ` Sudip Mukherjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150916094648.GA11711@gmail.com \
    --to=mingo@kernel.org \
    --cc=airlied@gmail.com \
    --cc=airlied@linux.ie \
    --cc=archit@ti.com \
    --cc=architt@codeaurora.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.