Messages in this thread Patch in this message | | | Date | Mon, 31 Jan 2000 09:53:57 +0000 (GMT) | From | Tigran Aivazian <> | Subject | [patch-2.3.41] Re: 2.3.41: kmalloc: Size (33554432) too large. |
| |
Hi,
Here is the whole story for those who prefer just the summary instead of the whole thread.
1. Patrick Mau noticed a problem caused by the bug in the patch I sumitted for the poll() change in 2.3.41
2. Manfred Spraul noticed that this problem could be caused by userspace passing nfds=0.
3. I now submit the fix to this problem. Instead of naively (like I have done in the 0th iteration of the patch) calling schedule_timeout() (or sys_nanosleep()) in a special case of nfds=0, we just let the code fall through (like it happens for select and like it used to happen for poll before my change) only checking that we don't leak memory and don't pass garbage to kmalloc. This way we correctly get -EINTR if interrupted and 0 if not interrupted, like on other UNIXen (e.g. UnixWare7)
A copy of the patch is on:
http://www.ocston.org/~tigran/patches/pollfix4.patch
Patrick, please let me know if your squid is now happy.
Regards, ------ Tigran A. Aivazian | http://www.sco.com Escalations Research Group | tel: +44-(0)1923-813796 Santa Cruz Operation Ltd | http://www.ocston.org/~tigran
--- select.c.0 Mon Jan 31 08:48:52 2000 +++ select.c Mon Jan 31 09:39:04 2000 @@ -414,11 +414,13 @@ wait = wait_table; } - fds = (struct pollfd **)kmalloc( - (1 + (nfds - 1) / POLLFD_PER_PAGE) * sizeof(struct pollfd *), - GFP_KERNEL); - if (fds == NULL) - goto out; + if (nfds != 0) { + fds = (struct pollfd **)kmalloc( + (1 + (nfds - 1) / POLLFD_PER_PAGE) * sizeof(struct pollfd *), + GFP_KERNEL); + if (fds == NULL) + goto out; + } nchunks = 0; nleft = nfds; @@ -467,7 +469,8 @@ out_fds: for (i=0; i < nchunks; i++) free_page((unsigned long)(fds[i])); - kfree(fds); + if (nfds != 0) + kfree(fds); out: if (wait) free_wait(wait_table);
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |