X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Feconet%2Faf_econet.c;h=06f5460516e0f92f0cb3f5d3d8b89082c05cbe29;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=07b4cff2f44d302d50ca20a044e46908e09ab44a;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 07b4cff2f..06f546051 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c @@ -39,14 +39,15 @@ #include #include #include +#include +#include #include #include -#include static struct proto_ops econet_ops; static struct hlist_head econet_sklist; -static rwlock_t econet_lock = RW_LOCK_UNLOCKED; +static DEFINE_RWLOCK(econet_lock); /* Since there are only 256 possible network numbers (or fewer, depends how you count) it makes sense to use a simple lookup table. */ @@ -401,16 +402,17 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, y.x maps to IP a.b.c.x. This should be replaced with something more flexible and more aware of subnet masks. */ { - struct in_device *idev = in_dev_get(dev); + struct in_device *idev; unsigned long network = 0; + + rcu_read_lock(); + idev = __in_dev_get(dev); if (idev) { - read_lock(&idev->lock); if (idev->ifa_list) network = ntohl(idev->ifa_list->ifa_address) & 0xffffff00; /* !!! */ - read_unlock(&idev->lock); - in_dev_put(idev); } + rcu_read_unlock(); udpdest.sin_addr.s_addr = htonl(network | addr.station); }