From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Stanislaw Gruszka <stf_xl@wp.pl>,
Andrew Morton <akpm@linux-foundation.org>
Cc: krzysztof.h1@wp.pl, linux-fbdev-devel@lists.sourceforge.net,
Haavard Skinnemoen <hskinnemoen@atmel.com>
Subject: Re: [PATCH 1/2] atmel_lcdfb: Fix oops in rmmod when framebuffer fail to register
Date: Fri, 05 Sep 2008 09:24:00 +0200 [thread overview]
Message-ID: <48C0DE90.5060505@atmel.com> (raw)
In-Reply-To: <200809031536.50390.stf_xl@wp.pl>
Stanislaw Gruszka :
> If framebuffer registration failed in platform driver ->probe() callback,
> dev_get_drvdata() points to freed memory region, but ->remove()
> function try to use it and the following oops occurs:
[..]
> This patch fix oops.
>
> Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
> CC: Nicolas Ferre <nicolas.ferre@atmel.com>
Feel free to add :
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> drivers/video/atmel_lcdfb.c | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> index a471a60..3376f35 100644
> --- a/drivers/video/atmel_lcdfb.c
> +++ b/drivers/video/atmel_lcdfb.c
> @@ -939,7 +939,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> ret = register_framebuffer(info);
> if (ret < 0) {
> dev_err(dev, "failed to register framebuffer device: %d\n", ret);
> - goto free_cmap;
> + goto reset_drvdata;
> }
>
> /* add selected videomode to modelist */
> @@ -955,7 +955,8 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
>
> return 0;
>
> -
> +reset_drvdata:
> + dev_set_drvdata(dev, NULL);
> free_cmap:
> fb_dealloc_cmap(&info->cmap);
> unregister_irqs:
> @@ -992,10 +993,11 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct fb_info *info = dev_get_drvdata(dev);
> - struct atmel_lcdfb_info *sinfo = info->par;
> + struct atmel_lcdfb_info *sinfo;
>
> - if (!sinfo)
> + if (!info || !info->par)
> return 0;
> + sinfo = info->par;
>
> cancel_work_sync(&sinfo->task);
> exit_backlight(sinfo);
--
Nicolas Ferre
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
prev parent reply other threads:[~2008-09-05 7:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-03 13:36 [PATCH 1/2] atmel_lcdfb: Fix oops in rmmod when framebuffer fail to register Stanislaw Gruszka
2008-09-03 18:51 ` Krzysztof Helt
2008-09-05 7:24 ` Nicolas Ferre [this message]
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=48C0DE90.5060505@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=akpm@linux-foundation.org \
--cc=hskinnemoen@atmel.com \
--cc=krzysztof.h1@wp.pl \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=stf_xl@wp.pl \
/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.