Messages in this thread Patch in this message | | | Date | Thu, 05 Mar 1998 11:48:17 -0500 | From | Bill Hawes <> | Subject | minor 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; | |