Bug fixes to 2.1.103

sjw44@eng.cam.ac.uk
Mon, 1 Jun 1998 10:12:39 +0100 (BST)


[I'm posting this again, since it did not seem to work the first time,
I'm sorry if you get two copies of it]

Here are a few bug fixes to the 2.1.103 netcode. They fix the following bugs:

o Add hook for Linux DECnet to netdevice structure
o Fix bug in rtnetlink which causes it to crash when any device calls
register_netdev() _before_ netlink is initialised (f.e. netrom). This
was due to rtn_unlock() dereferencing a pointer to the (not yet created)
netlink socket.
o sock->family member _must_ be set correctly even if the sock is not
zeroed out, as sock_no_dup() depends upon it.
o Wrong return value for sock_no_poll()

Also I have a question about register_netdev, and why its different from
register_netdevice(). I see no reason to have two functions performing
almost identical functions, I wonder if they might be merged in future.
I presume the rtnetlink lock/unlock stuff only need be performed if the
device is going up/down after the initial boot phase..?

Steve.

------------------------------------------------------------------------------
diff -r -u --new-file --exclude-from=exclude linux-2.1.103/include/linux/netdevice.h linux/include/linux/netdevice.h
--- linux-2.1.103/include/linux/netdevice.h Wed May 27 11:35:42 1998
+++ linux/include/linux/netdevice.h Fri May 29 23:12:02 1998
@@ -253,6 +253,7 @@

void *atalk_ptr; /* Appletalk link */
void *ip_ptr; /* IPv4 specific data */
+ void *dn_ptr; /* DECnet specific data */

struct Qdisc *qdisc;
struct Qdisc *qdisc_sleeping;
diff -r -u --new-file --exclude-from=exclude linux-2.1.103/include/linux/rtnetlink.h linux/include/linux/rtnetlink.h
--- linux-2.1.103/include/linux/rtnetlink.h Wed May 27 11:35:42 1998
+++ linux/include/linux/rtnetlink.h Sat May 30 10:42:29 1998
@@ -658,7 +658,7 @@
atomic_dec(&rtnl_rlockct);
if (atomic_read(&rtnl_rlockct) <= 1) {
wake_up(&rtnl_wait);
- if (rtnl->receive_queue.qlen)
+ if (rtnl && rtnl->receive_queue.qlen)
rtnl->data_ready(rtnl, 0);
}
}
@@ -672,7 +672,7 @@
atomic_dec(&rtnl_rlockct); \
if (atomic_read(&rtnl_rlockct) <= 1) { \
wake_up(&rtnl_wait); \
- if (rtnl->receive_queue.qlen) \
+ if (rtnl && rtnl->receive_queue.qlen) \
rtnl->data_ready(rtnl, 0); \
} \
})
diff -r -u --new-file --exclude-from=exclude linux-2.1.103/net/core/sock.c linux/net/core/sock.c
--- linux-2.1.103/net/core/sock.c Wed May 27 11:35:56 1998
+++ linux/net/core/sock.c Fri May 29 17:17:15 1998
@@ -480,8 +480,8 @@
{
struct sock *sk = kmem_cache_alloc(sk_cachep, priority);

- if(sk && zero_it) {
- memset(sk, 0, sizeof(struct sock));
+ if(sk) {
+ if (zero_it) memset(sk, 0, sizeof(struct sock));
sk->family = family;
}

@@ -500,6 +500,7 @@
{
sk_cachep = kmem_cache_create("sock", sizeof(struct sock), 0,
SLAB_HWCACHE_ALIGN, 0, 0);
+
}

/*
@@ -880,7 +881,7 @@

unsigned int sock_no_poll(struct file * file, struct socket *sock, poll_table *pt)
{
- return -EOPNOTSUPP;
+ return 0;
}

int sock_no_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)

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