[Skiboot] [PATCH] FSP: Validate fsp_msg response memory allocation

Stewart Smith stewart at linux.vnet.ibm.com
Mon Jul 11 13:43:46 AEST 2016


Vasant Hegde <hegdevasant at linux.vnet.ibm.com> writes:
> fsp_allocmsg() returns true even if msg->resp memory allocation fails.
> Validate msg->resp memory allocation as well.
>
> Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
> ---
>  hw/fsp/fsp.c |    8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c
> index 888da88..26cad63 100644
> --- a/hw/fsp/fsp.c
> +++ b/hw/fsp/fsp.c
> @@ -249,8 +249,14 @@ struct fsp_msg *fsp_allocmsg(bool alloc_response)
>  	msg = __fsp_allocmsg();
>  	if (!msg)
>  		return NULL;
> -	if (alloc_response)
> +	if (alloc_response) {
>  		msg->resp = __fsp_allocmsg();
> +		if (!msg->resp) {
> +			free(msg);
> +			return NULL;
> +		}
> +	}
> +
>  	return msg;
>  }
>

thanks, merged to master as of 58269b7

-- 
Stewart Smith
OPAL Architect, IBM.



More information about the Skiboot mailing list