minor patch for 2.1.88 net/core/sock.c

Bill Hawes (whawes@star.net)
Thu, 05 Mar 1998 11:48:17 -0500


This is a multi-part message in MIME format.
--------------21B25BEB83E6CF0E38A31F91
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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
--------------21B25BEB83E6CF0E38A31F91
Content-Type: text/plain; charset=us-ascii; name="net_sock88-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="net_sock88-patch"

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

--------------21B25BEB83E6CF0E38A31F91--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu