aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/af_decnet.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/decnet/af_decnet.c')
-rw-r--r--net/decnet/af_decnet.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index a205eaa87f52..9fbe87c93802 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -721,7 +721,7 @@ static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
721 struct sock *sk = sock->sk; 721 struct sock *sk = sock->sk;
722 struct dn_scp *scp = DN_SK(sk); 722 struct dn_scp *scp = DN_SK(sk);
723 struct sockaddr_dn *saddr = (struct sockaddr_dn *)uaddr; 723 struct sockaddr_dn *saddr = (struct sockaddr_dn *)uaddr;
724 struct net_device *dev; 724 struct net_device *dev, *ldev;
725 int rv; 725 int rv;
726 726
727 if (addr_len != sizeof(struct sockaddr_dn)) 727 if (addr_len != sizeof(struct sockaddr_dn))
@@ -746,14 +746,17 @@ static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
746 if (!(saddr->sdn_flags & SDF_WILD)) { 746 if (!(saddr->sdn_flags & SDF_WILD)) {
747 if (dn_ntohs(saddr->sdn_nodeaddrl)) { 747 if (dn_ntohs(saddr->sdn_nodeaddrl)) {
748 read_lock(&dev_base_lock); 748 read_lock(&dev_base_lock);
749 for(dev = dev_base; dev; dev = dev->next) { 749 ldev = NULL;
750 for_each_netdev(dev) {
750 if (!dev->dn_ptr) 751 if (!dev->dn_ptr)
751 continue; 752 continue;
752 if (dn_dev_islocal(dev, dn_saddr2dn(saddr))) 753 if (dn_dev_islocal(dev, dn_saddr2dn(saddr))) {
754 ldev = dev;
753 break; 755 break;
756 }
754 } 757 }
755 read_unlock(&dev_base_lock); 758 read_unlock(&dev_base_lock);
756 if (dev == NULL) 759 if (ldev == NULL)
757 return -EADDRNOTAVAIL; 760 return -EADDRNOTAVAIL;
758 } 761 }
759 } 762 }