lkml.org 
[lkml]   [1998]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectminor patch for 2.1.88 net/core/sock.c
The attached patch fixes a minor problem in sock_kmalloc. The test for available
space is done before the allocation and the size pre-added to the total, so
repeating the test for space after the allocation is not correct.

Regards,
Bill--- net/core/sock.c.old Wed Feb 11 00:06:13 1998
+++ net/core/sock.c Wed Mar 4 22:18:29 1998
@@ -580,12 +580,8 @@
*/
atomic_add(size, &sk->wmem_alloc);
mem = kmalloc(size, priority);
- if (mem) {
- /* Recheck because kmalloc might sleep */
- if (atomic_read(&sk->wmem_alloc)+size < sk->sndbuf)
- return mem;
- kfree_s(mem, size);
- }
+ if (mem)
+ return mem;
atomic_sub(size, &sk->wmem_alloc);
}
return mem;
\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.023 / U:0.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site