linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* (no subject)
@ 2001-01-10 18:24 Thiago Rondon
  2001-01-10 21:30 ` ds patch Dan Aloni
  2001-01-11  4:08 ` your mail David Hinds
  0 siblings, 2 replies; 3+ messages in thread
From: Thiago Rondon @ 2001-01-10 18:24 UTC (permalink / raw)
  To: dahinds; +Cc: Linux Kernel, Alan Cox


Check kmalloc().

-Thiago Rondon

--- linux-2.4.0-ac5/drivers/pcmcia/ds.c	Sat Sep  2 04:13:49 2000
+++ linux-2.4.0-ac5.maluco/drivers/pcmcia/ds.c	Wed Jan 10 16:20:53 2001
@@ -414,6 +414,8 @@
     /* Add binding to list for this socket */
     driver->use_count++;
     b = kmalloc(sizeof(socket_bind_t), GFP_KERNEL);
+    if (!b) 
+      return -ENOMEM;    
     b->driver = driver;
     b->function = bind_info->function;
     b->instance = NULL;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: ds patch
  2001-01-10 18:24 Thiago Rondon
@ 2001-01-10 21:30 ` Dan Aloni
  2001-01-11  4:08 ` your mail David Hinds
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Aloni @ 2001-01-10 21:30 UTC (permalink / raw)
  To: Thiago Rondon; +Cc: dahinds, linux-kernel, Alan Cox

On Wed, 10 Jan 2001, Thiago Rondon wrote:

> Check kmalloc().

In case where kmalloc() failed we shouldn't increase driver->use_count,
because we wouldn't be able to decrease it at unbind_request(), since we
got no matching socket_bind_t in the list.

Prehaps the increase of the use count should be moved after the 
check. Like:

--- linux/drivers/pcmcia/ds.c	Sat Sep  2 10:13:49 2000
+++ linux/drivers/pcmcia/ds.c	Wed Jan 10 23:23:10 2001
@@ -412,8 +412,11 @@
     }
 
     /* Add binding to list for this socket */
-    driver->use_count++;
     b = kmalloc(sizeof(socket_bind_t), GFP_KERNEL);
+    if (!b)
+    	return -ENOMEM;
+
+    driver->use_count++;
     b->driver = driver;
     b->function = bind_info->function;
     b->instance = NULL;

 

> -Thiago Rondon
> 
> --- linux-2.4.0-ac5/drivers/pcmcia/ds.c	Sat Sep  2 04:13:49 2000
> +++ linux-2.4.0-ac5.maluco/drivers/pcmcia/ds.c	Wed Jan 10 16:20:53 2001
> @@ -414,6 +414,8 @@
>      /* Add binding to list for this socket */
>      driver->use_count++;
>      b = kmalloc(sizeof(socket_bind_t), GFP_KERNEL);
> +    if (!b) 
> +      return -ENOMEM;    
>      b->driver = driver;
>      b->function = bind_info->function;
>      b->instance = NULL;

-- 
Dan Aloni 
dax@karrde.org

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: your mail
  2001-01-10 18:24 Thiago Rondon
  2001-01-10 21:30 ` ds patch Dan Aloni
@ 2001-01-11  4:08 ` David Hinds
  1 sibling, 0 replies; 3+ messages in thread
From: David Hinds @ 2001-01-11  4:08 UTC (permalink / raw)
  To: Thiago Rondon, dahinds; +Cc: Linux Kernel, Alan Cox

On Wed, Jan 10, 2001 at 04:24:21PM -0200, Thiago Rondon wrote:
> 
> Check kmalloc().
> 
> -Thiago Rondon
> 
> --- linux-2.4.0-ac5/drivers/pcmcia/ds.c	Sat Sep  2 04:13:49 2000
> +++ linux-2.4.0-ac5.maluco/drivers/pcmcia/ds.c	Wed Jan 10 16:20:53 2001
> @@ -414,6 +414,8 @@
>      /* Add binding to list for this socket */
>      driver->use_count++;
>      b = kmalloc(sizeof(socket_bind_t), GFP_KERNEL);
> +    if (!b) 
> +      return -ENOMEM;    
>      b->driver = driver;
>      b->function = bind_info->function;
>      b->instance = NULL;
> 

As with the other kmalloc patch, this is also broken; things have been
done that need to be un-done, and you can't just exit the function
here.  I'll come up with a better fix.

-- Dave
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

end of thread, other threads:[~2001-01-11  4:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-10 18:24 Thiago Rondon
2001-01-10 21:30 ` ds patch Dan Aloni
2001-01-11  4:08 ` your mail David Hinds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).