mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] firmware/dcdbas: add size check in smi_data_write
@ 2006-10-19  0:54 Doug Warzecha
  2006-10-19  3:47 ` Randy Dunlap
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Warzecha @ 2006-10-19  0:54 UTC (permalink / raw)
  To: akpm, linux-kernel


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 <Douglas_Warzecha@dell.com>

---

--- linux-2.6.19-rc2/drivers/firmware/dcdbas.c.orig	2006-10-18 18:52:43.000000000 -0500
+++ linux-2.6.19-rc2/drivers/firmware/dcdbas.c	2006-10-18 18:55:08.000000000 -0500
@@ -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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] firmware/dcdbas: add size check in smi_data_write
  2006-10-19  0:54 [PATCH] firmware/dcdbas: add size check in smi_data_write Doug Warzecha
@ 2006-10-19  3:47 ` Randy Dunlap
  0 siblings, 0 replies; 2+ messages in thread
From: Randy Dunlap @ 2006-10-19  3:47 UTC (permalink / raw)
  To: Doug Warzecha; +Cc: akpm, linux-kernel

On Wed, 18 Oct 2006 19:54:42 -0500 Doug Warzecha wrote:

> 
> 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.

I think that 'man 2 write' suggests EFBIG instead of EINVAL?


> ---
> 
> --- linux-2.6.19-rc2/drivers/firmware/dcdbas.c.orig	2006-10-18 18:52:43.000000000 -0500
> +++ linux-2.6.19-rc2/drivers/firmware/dcdbas.c	2006-10-18 18:55:08.000000000 -0500
> @@ -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);
> -


---
~Randy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-19  3:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-19  0:54 [PATCH] firmware/dcdbas: add size check in smi_data_write Doug Warzecha
2006-10-19  3:47 ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®