diff mbox

efi_pstore: add missing iounmap() on error in erst_exec_move_data()

Message ID CAPgLHd-x4N6NVJUWz9Tr4onnBgEwLW6CNQqS1_upSQzPKSoX2Q@mail.gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Wei Yongjun July 2, 2013, 1:02 a.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Add the missing iounmap() before return from erst_exec_move_data()
in the error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/acpi/apei/erst.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Kees Cook July 2, 2013, 6:50 p.m. UTC | #1
On Mon, Jul 1, 2013 at 6:02 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Add the missing iounmap() before return from erst_exec_move_data()
> in the error handling case.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/acpi/apei/erst.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
> index f7b3b39..7af21ed 100644
> --- a/drivers/acpi/apei/erst.c
> +++ b/drivers/acpi/apei/erst.c
> @@ -284,8 +284,10 @@ static int erst_exec_move_data(struct apei_exec_context *ctx,
>         if (!src)
>                 return -ENOMEM;
>         dst = ioremap(ctx->dst_base + offset, ctx->var2);
> -       if (!dst)
> +       if (!dst) {
> +               iounmap(src);
>                 return -ENOMEM;
> +       }
>
>         memmove(dst, src, ctx->var2);

Good catch!

Acked-by: Kees Cook <keescook@chromium.org>

Thanks,

-Kees

--
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Luck July 8, 2013, 6:34 p.m. UTC | #2
On Tue, Jul 2, 2013 at 11:50 AM, Kees Cook <keescook@chromium.org> wrote:
> On Mon, Jul 1, 2013 at 6:02 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
>> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> Good catch!
>
> Acked-by: Kees Cook <keescook@chromium.org>

Applied.  Thanks

-Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index f7b3b39..7af21ed 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -284,8 +284,10 @@  static int erst_exec_move_data(struct apei_exec_context *ctx,
 	if (!src)
 		return -ENOMEM;
 	dst = ioremap(ctx->dst_base + offset, ctx->var2);
-	if (!dst)
+	if (!dst) {
+		iounmap(src);
 		return -ENOMEM;
+	}
 
 	memmove(dst, src, ctx->var2);