* [PATCH] fsl-rio: Release rapidio port I/O region resource if port failed to initialize
@ 2011-09-01 9:52 ` Liu Gang
0 siblings, 0 replies; 4+ messages in thread
From: Liu Gang @ 2011-09-01 9:52 UTC (permalink / raw)
To: linuxppc-dev; +Cc: akpm, linux-kernel, r58472, B11780, r61911, Liu Gang
The "struct rio_mport" contains a member of master port I/O memory resource structure
"struct resource iores". This resource will be read from device tree and be used for
rapidio R/W transaction memory space. Rapidio requests the port I/O memory resource
under the root resource "iomem_resource".
struct rio_mport *port;
port = kzalloc(sizeof(struct rio_mport), GFP_KERNEL);
request_resource(&iomem_resource, &port->iores);
When port failed to initialize, allocated "rio_mport" structure memory will be freed,
and the port I/O memory resource structure pointer "&port->iores" will be invalid. If
other requests resource under "iomem_resource", "&port->iores" node may be operated in
the child resources list and this will cause the system to crash.
So the requested port I/O memory resource should be released before freeing allocated
"rio_mport" structure.
Signed-off-by: Liu Gang <Gang.Liu@freescale.com>
---
arch/powerpc/sysdev/fsl_rio.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index c65f75a..22ffccd 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1608,6 +1608,7 @@ int fsl_rio_setup(struct platform_device *dev)
return 0;
err:
iounmap(priv->regs_win);
+ release_resource(&port->iores);
err_res:
kfree(priv);
err_priv:
--
1.7.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] fsl-rio: Release rapidio port I/O region resource if port failed to initialize
@ 2011-09-01 9:52 ` Liu Gang
0 siblings, 0 replies; 4+ messages in thread
From: Liu Gang @ 2011-09-01 9:52 UTC (permalink / raw)
To: linuxppc-dev; +Cc: r58472, r61911, linux-kernel, Liu Gang, akpm, B11780
The "struct rio_mport" contains a member of master port I/O memory resource structure
"struct resource iores". This resource will be read from device tree and be used for
rapidio R/W transaction memory space. Rapidio requests the port I/O memory resource
under the root resource "iomem_resource".
struct rio_mport *port;
port = kzalloc(sizeof(struct rio_mport), GFP_KERNEL);
request_resource(&iomem_resource, &port->iores);
When port failed to initialize, allocated "rio_mport" structure memory will be freed,
and the port I/O memory resource structure pointer "&port->iores" will be invalid. If
other requests resource under "iomem_resource", "&port->iores" node may be operated in
the child resources list and this will cause the system to crash.
So the requested port I/O memory resource should be released before freeing allocated
"rio_mport" structure.
Signed-off-by: Liu Gang <Gang.Liu@freescale.com>
---
arch/powerpc/sysdev/fsl_rio.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index c65f75a..22ffccd 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1608,6 +1608,7 @@ int fsl_rio_setup(struct platform_device *dev)
return 0;
err:
iounmap(priv->regs_win);
+ release_resource(&port->iores);
err_res:
kfree(priv);
err_priv:
--
1.7.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] fsl-rio: Release rapidio port I/O region resource if portfailed to initialize
2011-09-01 9:52 ` Liu Gang
@ 2011-09-01 13:29 ` Bounine, Alexandre
-1 siblings, 0 replies; 4+ messages in thread
From: Bounine, Alexandre @ 2011-09-01 13:29 UTC (permalink / raw)
To: Liu Gang, linuxppc-dev; +Cc: r58472, r61911, linux-kernel, akpm, B11780
On Thursday, September 01, 2011 5:52 AM
Liu Gang <Gang.Liu@freescale.com> wrote:
> Subject: [PATCH] fsl-rio: Release rapidio port I/O region resource if
> portfailed to initialize
>
...
>
> Signed-off-by: Liu Gang <Gang.Liu@freescale.com>
> ---
> arch/powerpc/sysdev/fsl_rio.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/fsl_rio.c
> b/arch/powerpc/sysdev/fsl_rio.c
> index c65f75a..22ffccd 100644
> --- a/arch/powerpc/sysdev/fsl_rio.c
> +++ b/arch/powerpc/sysdev/fsl_rio.c
> @@ -1608,6 +1608,7 @@ int fsl_rio_setup(struct platform_device *dev)
> return 0;
> err:
> iounmap(priv->regs_win);
> + release_resource(&port->iores);
> err_res:
> kfree(priv);
> err_priv:
> --
> 1.7.3.1
Acked-by: Alexandre Bounine <alexandre.bounine@idt.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] fsl-rio: Release rapidio port I/O region resource if portfailed to initialize
@ 2011-09-01 13:29 ` Bounine, Alexandre
0 siblings, 0 replies; 4+ messages in thread
From: Bounine, Alexandre @ 2011-09-01 13:29 UTC (permalink / raw)
To: Liu Gang, linuxppc-dev; +Cc: linux-kernel, akpm, B11780, r58472, r61911
On Thursday, September 01, 2011 5:52 AM
Liu Gang <Gang.Liu@freescale.com> wrote:
> Subject: [PATCH] fsl-rio: Release rapidio port I/O region resource if
> portfailed to initialize
>=20
...
>=20
> Signed-off-by: Liu Gang <Gang.Liu@freescale.com>
> ---
> arch/powerpc/sysdev/fsl_rio.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>=20
> diff --git a/arch/powerpc/sysdev/fsl_rio.c
> b/arch/powerpc/sysdev/fsl_rio.c
> index c65f75a..22ffccd 100644
> --- a/arch/powerpc/sysdev/fsl_rio.c
> +++ b/arch/powerpc/sysdev/fsl_rio.c
> @@ -1608,6 +1608,7 @@ int fsl_rio_setup(struct platform_device *dev)
> return 0;
> err:
> iounmap(priv->regs_win);
> + release_resource(&port->iores);
> err_res:
> kfree(priv);
> err_priv:
> --
> 1.7.3.1
Acked-by: Alexandre Bounine <alexandre.bounine@idt.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-09-01 13:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-01 9:52 [PATCH] fsl-rio: Release rapidio port I/O region resource if port failed to initialize Liu Gang
2011-09-01 9:52 ` Liu Gang
2011-09-01 13:29 ` [PATCH] fsl-rio: Release rapidio port I/O region resource if portfailed " Bounine, Alexandre
2011-09-01 13:29 ` Bounine, Alexandre
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.