Patchwork [3/8] powerpc/pseries: pack update_props_workarea to map correctly to rtas buffer header

login
register
mail settings
Submitter Tyrel Datwyler
Date Aug. 15, 2013, 5:23 a.m.
Message ID <1376544232-24936-4-git-send-email-tyreld@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/267317/
State Accepted
Commit d0ef440350ff9d1c72e52c837302df090c4d2725
Headers show

Comments

Tyrel Datwyler - Aug. 15, 2013, 5:23 a.m.
The work area buffer returned by the ibm,update-properties rtas call contains
20 bytes of header information prior to the property value descriptor data.
Currently update_dt_node tries to advance over this header using sizeof(upwa).
The update_props_workarea struct contains 20 bytes worth of fields, that map
to the relevant header data, but the sizeof the structure is 24 bytes due to
4 bytes of padding at the end of the structure. Packing the structure ensures
that we don't advance too far over the rtas buffer.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/mobility.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Nathan Fontenot - Aug. 19, 2013, 1:46 p.m.
On 08/15/2013 12:23 AM, Tyrel Datwyler wrote:
> The work area buffer returned by the ibm,update-properties rtas call contains
> 20 bytes of header information prior to the property value descriptor data.
> Currently update_dt_node tries to advance over this header using sizeof(upwa).
> The update_props_workarea struct contains 20 bytes worth of fields, that map
> to the relevant header data, but the sizeof the structure is 24 bytes due to
> 4 bytes of padding at the end of the structure. Packing the structure ensures
> that we don't advance too far over the rtas buffer.
> 
> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>

> ---
>  arch/powerpc/platforms/pseries/mobility.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
> index aaae85d..023e354 100644
> --- a/arch/powerpc/platforms/pseries/mobility.c
> +++ b/arch/powerpc/platforms/pseries/mobility.c
> @@ -28,7 +28,7 @@ struct update_props_workarea {
>  	u32 state;
>  	u64 reserved;
>  	u32 nprops;
> -};
> +} __packed;
>  
>  #define NODE_ACTION_MASK	0xff000000
>  #define NODE_COUNT_MASK		0x00ffffff
>

Patch

diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index aaae85d..023e354 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -28,7 +28,7 @@  struct update_props_workarea {
 	u32 state;
 	u64 reserved;
 	u32 nprops;
-};
+} __packed;
 
 #define NODE_ACTION_MASK	0xff000000
 #define NODE_COUNT_MASK		0x00ffffff