2010-07-07 02:52:21

by Peter Huewe

[permalink] [raw]
Subject: [PATCH] staging/panel: Prevent double-calling of parport_release - fix oops.

From: Peter Huewe <[email protected]>

This patch prevents the code from calling parport_release and
parport_unregister_device twice with the same arguments - and thus fixes an oops.

Rationale:
After the first call the parport is already released and the
handle isn't valid anymore and calling parport_release and
parport_unregister_device twice isn't a good idea.

Signed-off-by: Peter Huewe <[email protected]>
---
KernelVersion: linux-next-20100607

drivers/staging/panel/panel.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 3154ffe..6fa57be 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2277,6 +2277,7 @@ int panel_init(void)
if (pprt) {
parport_release(pprt);
parport_unregister_device(pprt);
+ pprt = NULL;
}
parport_unregister_driver(&panel_driver);
printk(KERN_ERR "Panel driver version " PANEL_VERSION
@@ -2327,6 +2328,7 @@ static void __exit panel_cleanup_module(void)
/* TODO: free all input signals */
parport_release(pprt);
parport_unregister_device(pprt);
+ pprt = NULL;
}
parport_unregister_driver(&panel_driver);
}
--
1.7.1


2010-07-07 04:14:11

by Willy Tarreau

[permalink] [raw]
Subject: Re: [PATCH] staging/panel: Prevent double-calling of parport_release - fix oops.

On Wed, Jul 07, 2010 at 04:52:16AM +0200, Peter Huewe wrote:
> From: Peter Huewe <[email protected]>
>
> This patch prevents the code from calling parport_release and
> parport_unregister_device twice with the same arguments - and thus fixes an oops.
>
> Rationale:
> After the first call the parport is already released and the
> handle isn't valid anymore and calling parport_release and
> parport_unregister_device twice isn't a good idea.
>
> Signed-off-by: Peter Huewe <[email protected]>
> ---
> KernelVersion: linux-next-20100607
>
> drivers/staging/panel/panel.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
> index 3154ffe..6fa57be 100644
> --- a/drivers/staging/panel/panel.c
> +++ b/drivers/staging/panel/panel.c
> @@ -2277,6 +2277,7 @@ int panel_init(void)
> if (pprt) {
> parport_release(pprt);
> parport_unregister_device(pprt);
> + pprt = NULL;
> }
> parport_unregister_driver(&panel_driver);
> printk(KERN_ERR "Panel driver version " PANEL_VERSION
> @@ -2327,6 +2328,7 @@ static void __exit panel_cleanup_module(void)
> /* TODO: free all input signals */
> parport_release(pprt);
> parport_unregister_device(pprt);
> + pprt = NULL;
> }
> parport_unregister_driver(&panel_driver);
> }
> --
> 1.7.1

look fine, ACK by me !

Willy