/*
- * sanity-check function..
- */
-static void put_page(pte_t * page_table, pte_t pte)
-{
- if (!pte_none(*page_table)) {
- free_page_and_swap_cache(pte_page(pte));
- return;
- }
-/* no need for flush_tlb */
- set_pte(page_table, pte);
-}
-
-/*
* This routine is used to map in a page into an address space: needed by
* execve() for the initial stack and environment pages.
*/
@@ -817,7 +804,8 @@ static int do_anonymous_page(struct task
tsk->min_flt++;
flush_page_to_ram(page);
}
- put_page(page_table, entry);
+ wmb();
+ set_pte(page_table, entry);
return 1;
}
@@ -875,7 +863,8 @@ static int do_no_page(struct task_struct
} else if (atomic_read(&mem_map[MAP_NR(page)].count) > 1 &&
!(vma->vm_flags & VM_SHARED))
entry = pte_wrprotect(entry);
- put_page(page_table, entry);
+ wmb();
+ set_pte(page_table, entry);
/* no need to invalidate: a not-present page shouldn't be cached */
return 1;
}
--- ./net/ipv4/tcp.c.~1~ Sat Jan 9 03:20:07 1999
+++ ./net/ipv4/tcp.c Fri Jan 22 06:26:32 1999
@@ -415,6 +415,7 @@
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/poll.h>
+#include <linux/smp_lock.h>
#include <linux/init.h>
#include <net/icmp.h>
@@ -891,6 +892,8 @@ int tcp_do_sendmsg(struct sock *sk, int
continue;
}
+ unlock_kernel();
+
seglen -= copy;
/* Prepare control bits for TCP header creation engine. */
@@ -909,8 +912,10 @@ int tcp_do_sendmsg(struct sock *sk, int
* Reserve header space and checksum the data.
*/
skb_reserve(skb, MAX_HEADER + sk->prot->max_header);
+
skb->csum = csum_and_copy_from_user(from,
skb_put(skb, copy), copy, 0, &err);
+ lock_kernel();
if (err)
goto do_fault;
@@ -1261,7 +1266,11 @@ int tcp_recvmsg(struct sock *sk, struct
* do a second read it relies on the skb->users to avoid
* a crash when cleanup_rbuf() gets called.
*/
+
+ unlock_kernel();
err = memcpy_toiovec(msg->msg_iov, ((unsigned char *)skb->h.th) + skb->h.th->doff*4 + offset, used);
+ lock_kernel();
+
if (err) {
/* Exception. Bailout! */
atomic_dec(&skb->users);
--- ./net/ipv4/udp.c.~1~ Sun Jan 3 07:56:15 1999
+++ ./net/ipv4/udp.c Fri Jan 22 08:08:06 1999
@@ -105,6 +105,7 @@
#include <linux/config.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
+#include <linux/smp_lock.h>
#include <net/snmp.h>
#include <net/ip.h>
#include <net/protocol.h>
@@ -585,10 +586,14 @@ struct udpfakehdr
static int udp_getfrag(const void *p, char * to, unsigned int offset, unsigned int fraglen)
{
struct udpfakehdr *ufh = (struct udpfakehdr *)p;
+ int err = 0;
+
+ unlock_kernel();
if (offset==0) {
+ err = -EFAULT;
if (csum_partial_copy_fromiovecend(to+sizeof(struct udphdr), ufh->iov, offset,
fraglen-sizeof(struct udphdr), &ufh->wcheck))
- return -EFAULT;
+ goto out;
ufh->wcheck = csum_partial((char *)ufh, sizeof(struct udphdr),
ufh->wcheck);
ufh->uh.check = csum_tcpudp_magic(ufh->saddr, ufh->daddr,
@@ -597,12 +602,14 @@ static int udp_getfrag(const void *p, ch
if (ufh->uh.check == 0)
ufh->uh.check = -1;
memcpy(to, ufh, sizeof(struct udphdr));
- return 0;
- }
- if (csum_partial_copy_fromiovecend(to, ufh->iov, offset-sizeof(struct udphdr),
- fraglen, &ufh->wcheck))
- return -EFAULT;
- return 0;
+ err = 0;
+ } else if (csum_partial_copy_fromiovecend(to, ufh->iov,
+ offset-sizeof(struct udphdr),
+ fraglen, &ufh->wcheck))
+ err = -EFAULT;
+out:
+ lock_kernel();
+ return err;
}
/*
@@ -615,14 +622,19 @@ static int udp_getfrag(const void *p, ch
static int udp_getfrag_nosum(const void *p, char * to, unsigned int offset, unsigned int fraglen)
{
struct udpfakehdr *ufh = (struct udpfakehdr *)p;
+ int ret;