firmware/dcdbas: add size check in smi_data_write
PATCH 1/1 firmware/dcdbas: add size check in smi_data_write
This patch adds a size check in smi_data_write to prevent possible wrapping problems with large pos values when calling smi_data_buf_realloc on 32-bit.
Signed-off-by Doug Warzecha <[email protected]>
---
drivers/firmware/dcdbas.c renamed from drivers/firmware/dcdbas.c.orig +5 -2
@@ -8,7 +8,7 @@* * See Documentation/dcdbas.txt for more information. * -* Copyright (C) 1995-2005 Dell Inc. +* Copyright (C) 1995-2006 Dell Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License v2.0 as published by
@@ -40,7 +40,7 @@#include "dcdbas.h" #define DRIVER_NAME "dcdbas" -#define DRIVER_VERSION "5.6.0-2" +#define DRIVER_VERSION "5.6.0-3.2"#define DRIVER_DESCRIPTION "Dell Systems Management Base Driver"static struct platform_device *dcdbas_pdev;
@@ -175,6 +175,9 @@ static ssize_t smi_data_write(struct kob {ssize_t ret; +if ((pos + count) >MAX_SMI_DATA_BUF_SIZE ) +return -EINVAL ; +mutex_lock (&smi_data_lock); ret =smi_data_buf_realloc (pos + count);
Quoted 2 lines · On Wed, 18 Oct 2006 19:54:42 -0500 Doug Warzecha wrote:
This patch adds a size check in
smi_data_writeto prevent possible wrapping problems with large pos values when callingsmi_data_buf_reallocon 32-bit.
I think that 'man 2 write' suggests EFBIG instead of EINVAL?
Quoted 23 lines
---
drivers/firmware/dcdbas.c renamed from drivers/firmware/dcdbas.c.orig +2
-2@@ -8,7 +8,7 @@* * See Documentation/dcdbas.txt for more information. * -* Copyright (C) 1995-2005 Dell Inc. +* Copyright (C) 1995-2006 Dell Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License v2.0 as published by @@ -40,7 +40,7 @@#include "dcdbas.h" #define DRIVER_NAME "dcdbas" -#define DRIVER_VERSION "5.6.0-2" +#define DRIVER_VERSION "5.6.0-3.2"#define DRIVER_DESCRIPTION "Dell Systems Management Base Driver"static struct platform_device *dcdbas_pdev;
drivers/firmware/dcdbas.c static ssize_t smi_data_write(struct kob
Quoted 10 lines
drivers/firmware/dcdbas.c renamed from drivers/firmware/dcdbas.c.orig +3
-1@@ -175,6 +175,9 @@ static ssize_t smi_data_write(struct kob {ssize_t ret; +if ((pos + count) >MAX_SMI_DATA_BUF_SIZE ) +return -EINVAL ; +mutex_lock (&smi_data_lock); ret =smi_data_buf_realloc (pos + count); -
---
~Randy