aboutsummaryrefslogtreecommitdiff
path: root/pfinet
diff options
context:
space:
mode:
Diffstat (limited to 'pfinet')
-rw-r--r--pfinet/glue-include/linux/sched.h3
-rw-r--r--pfinet/io-ops.c11
-rw-r--r--pfinet/linux-src/include/asm-i386/checksum.h6
-rw-r--r--pfinet/linux-src/net/ipv4/tcp_ipv4.c2
-rw-r--r--pfinet/sched.c8
-rw-r--r--pfinet/socket-ops.c5
6 files changed, 26 insertions, 9 deletions
diff --git a/pfinet/glue-include/linux/sched.h b/pfinet/glue-include/linux/sched.h
index f57de2c3..d4cae42a 100644
--- a/pfinet/glue-include/linux/sched.h
+++ b/pfinet/glue-include/linux/sched.h
@@ -162,7 +162,8 @@ schedule_timeout (long timeout)
{
long expire = timeout + jiffies;
struct timer_list timer;
- struct wait_queue *sleep = 0; /* See comment in wait.h why this suffices. */
+ static struct wait_queue *sleep = 0; /* See comment in wait.h why this suffices. */
+ /* TODO: but free it !! */
init_timer (&timer);
timer.expires = expire;
diff --git a/pfinet/io-ops.c b/pfinet/io-ops.c
index 21bc3ac2..ef8d8513 100644
--- a/pfinet/io-ops.c
+++ b/pfinet/io-ops.c
@@ -87,6 +87,11 @@ S_io_read (struct sock_user *user,
if (amount > *datalen)
{
*data = mmap (0, amount, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
+ if (*data == MAP_FAILED)
+ /* Should check whether errno is indeed ENOMEM --
+ but this can't be done in a straightforward way,
+ because the glue headers #undef errno. */
+ return ENOMEM;
alloced = 1;
}
@@ -102,7 +107,11 @@ S_io_read (struct sock_user *user,
__mutex_unlock (&global_lock);
if (err < 0)
- err = -err;
+ {
+ err = -err;
+ if (alloced)
+ munmap (*data, amount);
+ }
else
{
*datalen = err;
diff --git a/pfinet/linux-src/include/asm-i386/checksum.h b/pfinet/linux-src/include/asm-i386/checksum.h
index ed023174..add89590 100644
--- a/pfinet/linux-src/include/asm-i386/checksum.h
+++ b/pfinet/linux-src/include/asm-i386/checksum.h
@@ -109,7 +109,8 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
are modified, we must also specify them as outputs, or gcc
will assume they contain their original values. */
: "=r" (sum), "=r" (iph), "=r" (ihl)
- : "1" (iph), "2" (ihl));
+ : "1" (iph), "2" (ihl)
+ : "memory");
return(sum);
}
@@ -185,7 +186,8 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
"adcl $0, %0\n"
: "=&r" (sum)
: "r" (saddr), "r" (daddr),
- "r"(htonl((__u32) (len))), "r"(htonl(proto)), "0"(sum));
+ "r"(htonl((__u32) (len))), "r"(htonl(proto)), "0"(sum)
+ : "memory");
return csum_fold(sum);
}
diff --git a/pfinet/linux-src/net/ipv4/tcp_ipv4.c b/pfinet/linux-src/net/ipv4/tcp_ipv4.c
index 2364de33..ab6db9bb 100644
--- a/pfinet/linux-src/net/ipv4/tcp_ipv4.c
+++ b/pfinet/linux-src/net/ipv4/tcp_ipv4.c
@@ -613,7 +613,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
return -ENETUNREACH;
}
- dst_release(xchg(&sk->dst_cache, rt));
+ dst_release(xchg(&sk->dst_cache, &rt->u.dst));
buff = sock_wmalloc(sk, (MAX_HEADER + sk->prot->max_header),
0, GFP_KERNEL);
diff --git a/pfinet/sched.c b/pfinet/sched.c
index 6c6c8241..37e4ecbd 100644
--- a/pfinet/sched.c
+++ b/pfinet/sched.c
@@ -58,13 +58,13 @@ sock_wake_async (struct socket *sock, int how)
any_t
net_bh_worker (any_t arg)
{
- __mutex_lock (&global_lock);
+ __mutex_lock (&net_bh_lock);
while (1)
{
- condition_wait (&net_bh_wakeup, &global_lock);
- __mutex_lock (&net_bh_lock);
+ condition_wait (&net_bh_wakeup, &net_bh_lock);
+ __mutex_lock (&global_lock);
net_bh ();
- __mutex_unlock (&net_bh_lock);
+ __mutex_unlock (&global_lock);
}
/*NOTREACHED*/
return 0;
diff --git a/pfinet/socket-ops.c b/pfinet/socket-ops.c
index baeaad30..b9ce6c72 100644
--- a/pfinet/socket-ops.c
+++ b/pfinet/socket-ops.c
@@ -499,6 +499,11 @@ S_socket_recv (struct sock_user *user,
if (amount > *datalen)
{
*data = mmap (0, amount, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
+ if (*data == MAP_FAILED)
+ /* Should check whether errno is indeed ENOMEM --
+ but this can't be done in a straightforward way,
+ because the glue headers #undef errno. */
+ return ENOMEM;
alloced = 1;
}